Re: python 3.3/3.4 psycopg2 assertion failure on syncdb

2013-04-09 Thread Demian Brecht
> Assertion failed: (PyBytes_Check(((typecastObject*)cast)->name)),
> function _pq_fetch_tuples, file psycopg/pqpath.c, line 1138.
> Abort trap: 6

Oops. I had built psycopg2 against 3.4, which is where this error
comes up. Built against 3.3, everything works as expected.

I need sleep :P

On Mon, Apr 8, 2013 at 11:40 PM, Demian Brecht  wrote:
> Before I spend too much time digging into this, I'm wondering if
> anyone else has run into this. I have both 3.3 (from binaries) and 3.4
> (from source) installed on OSX 10.8.3 (running postgre 9.2.2.0). I
> haven't set up any models for my app yet, but upon running syncdb, I'm
> getting:
>
> Assertion failed: (PyBytes_Check(((typecastObject*)cast)->name)),
> function _pq_fetch_tuples, file psycopg/pqpath.c, line 1138.
> Abort trap: 6
>
> Can anyone shed some light on this before I dig into gdb?
>
> Thanks,
>
> --
> Demian Brecht
> http://demianbrecht.github.com



-- 
Demian Brecht
http://demianbrecht.github.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




python 3.3/3.4 psycopg2 assertion failure on syncdb

2013-04-09 Thread Demian Brecht
Before I spend too much time digging into this, I'm wondering if
anyone else has run into this. I have both 3.3 (from binaries) and 3.4
(from source) installed on OSX 10.8.3 (running postgre 9.2.2.0). I
haven't set up any models for my app yet, but upon running syncdb, I'm
getting:

Assertion failed: (PyBytes_Check(((typecastObject*)cast)->name)),
function _pq_fetch_tuples, file psycopg/pqpath.c, line 1138.
Abort trap: 6

Can anyone shed some light on this before I dig into gdb?

Thanks,

--
Demian Brecht
http://demianbrecht.github.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[ANN] django-sanction 0.3 released

2013-04-09 Thread Demian Brecht
After a small hiatus, I've released django-sanction 0.3.
django-sanction is an easy-to-use app wrapping the sanction OAuth 2.0
client library (https://github.com/demianbrecht/sanction). New
features:

* Upgraded to Django 1.5 (/not/ backwards-compatible)
* Python 2/3 compatible

https://github.com/demianbrecht/django-sanction

Docs are available at https://django-sanction.readthedocs.org/en/latest/.

--

Demian Brecht
http://demianbrecht.github.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: object has no attribute '_state'

2012-10-09 Thread Demian Brecht

On 12-10-09 02:12 AM, Tom Evans wrote:

On Fri, Oct 5, 2012 at 6:13 PM, Demian Brecht  wrote:

Call me paranoid: https://fuhm.net/super-harmful/


One guys (well publicized) internet rant on why he dislikes super does
not necessarily mean he is correct. Even if he is, follow his own
advice:

   Subclasses must use super if their superclasses do


Good catch, thanks.. Although now I'm interested as to *why* the 
resulting behavior is as detailed in the blog..


--
Demian Brecht
@demianbrecht
http://demianbrecht.github.com

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: object has no attribute '_state'

2012-10-05 Thread Demian Brecht
>
>
> I'm sure the OP from June 2010 will be pleased that his question has
> been answered so many times…
>

Eek, guess I should have read the posting date.


> PS: To call the parent class(es) constuctor(s) correctly when using
> python "new style" classes (ie: all Django classes and classes derived
> from Django classes), you should use super(ClassName, self).__init__()
> and not call the base class directly.


Call me paranoid: https://fuhm.net/super-harmful/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: object has no attribute '_state'

2012-10-05 Thread Demian Brecht



class QuestionSet(models.Model):
 title = models.CharField(max_length=100)
 description = models.TextField()
 order = models.IntegerField()

 def __init__(self, *args, **kwargs):
 self.title = kwargs.get('title','Default Title')
 self.description = kwargs.get('description', 'DefDescription')
 self.order = kwargs.get('order', 0)


One thing that looks suspect to me here is that you're not calling 
__init__ on models.Model.


def __init__(self, *args, **kwargs):
models.Model.__init__(self, ...)

Which will prevent the base class from initializing.

For example:

>>> class A(object):
... def __init__(self):
... print 'A init'
...
>>> class B(A):
... def __init__(self):
... A.__init__(self)
... print 'B init'
...
>>> class C(A):
... def __init__(self):
... print 'C init'
...
>>> C()
C init
<__main__.C object at 0x7fd811c23bd0>
>>> B()
A init
B init
<__main__.B object at 0x7fd811c23c50>

Constructor calls don't bubble up on their own, you have to explicitly 
call them.


I would assume that something in the model's base class is what adds the 
_state attribute. By short circuiting the constructor, you're preventing 
this from ever happening.


--
Demian Brecht
@demianbrecht
http://demianbrecht.github.com

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Development server won't work from a shared web host

2012-09-06 Thread Demian Brecht
You *can* install Django on Linux, Mac or Windows. Choose the
environment that you're most accustomed to if you're just trying to
get things done. However, if you want to learn Linux at the same time
(at least, bits of it), then I fully endorse going down that path.

On Wed, Sep 5, 2012 at 9:19 PM, ecs1749  wrote:
>
> Ok, ok.  I now have a Ubuntu/server with a Ubuntu desktop running using 
> oracle vm virtualbox.   I know almost nothing about Linux.  I don't even know 
> how to ssh to this beast sitting in front of me.  I  hope this is a start...
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: What is the easy way to install DJango?

2012-08-22 Thread Demian Brecht
> Or installing the M$ VC++ Express edition compatible with the
> version used for the Python build 
> --
> Wulfraed Dennis Lee Bieber AF6VN
> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/
>
>
Sure (or MinGW if I'm not mistaken) but the question was asking about an
"easy" way. I'm not sure that setting up a full build environment on a
Windows machine would qualify it to be such. Of course, that's entirely
subjective and not really related to the question at hand ;)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: What is the easy way to install DJango?

2012-08-22 Thread Demian Brecht
Er, it's easy to install on Windows until you want to install a package
that has C extensions. Then, you're either scouring the web for pre-builts
(which can be a pain depending on your architecture and your level of
paranoia about the contents of the binaries) or you're installing a GNU
toolchain on a Windows machine, which is far from easy for someone new(er)
to Python development (unless they come from a Linux environment anyway).
Examples of such modules are MySQLdb and pycrypto.

I also +1 getting used to Linux for Python/Django development. Makes the
world a happier place ;)



On Wed, Aug 15, 2012 at 6:00 AM, Jirka Vejrazka wrote:

> It's easy to install Django on a Windows machine to test it out and
> develop code. Most of this is covered here:
> https://docs.djangoproject.com/en/1.4/topics/install/
>
> In a nutshell, you need:
> - Python 2.x (2.7) - install it if you already have not done so
> - Django (start with a stable release e.g. 1.4, download link on the
> main Django page)
> - to install the downloaded Django package (covered in docs)
> - to find your "django-admin.py" (most likely in C:\Python27\Scripts)
> and use it to create your first project.
> - follow the official tutorial to learn the basics
>
> https://docs.djangoproject.com/en/1.4/intro/tutorial01/
>
>   It's pretty straightforward, most people have trouble locating the
> django-admin.py which is not on system PATH by default.
>
>  HTH
>
>Jirka
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



[ANNC] django-sanction 0.1.0 (OAuth2 client)

2012-08-16 Thread Demian Brecht
django-sanction is a wrapper for the sanction OAuth2 client library.

High level features include:

Provider agnostic: There is no assumption made about what providers should
be accounted for (as in the core sanction module). This means that while
providers that follow the OAuth 2 spec should be handled by default,
deviant providers may have to have custom implementations for certain
handlers (see stackexchange and facebook examples in the examples
directory). This also means that the user may need to have at least a basic
understanding of OAuth 2 and provider implementations. However, the upside
is that the library is flexible in that library maintenance does not need
to occur in order to support new OAuth 2 providers as they come out of the
woodwork.

Persistence agnostic:django_sanction doesn't care if you use the provided
django_sanction.models.User model (which is an extension of the
contrib.auth User model) or a custom nonrel user class, as long as a few
required attributes exist on the model

Flexible: While most functionality is accounted for and provided out of the
box, django_sanction is flexible where it makes sense to be.

Security: By default, django-sanction uses CSRF protection to make
authorization as secure as the spec allows for.

Modular: django-sanction is meant to be an OAuth 2 client and will only be
an OAuth 2 client. It is not the kitchen sink of
authentication/authorization.

Oh, did I mention that the entire sanction client library is 65 LOC and
django-sanction (including models, middleware, etc) is slightly over 200?
That makes the entire thing pretty easy to grok, even for a beginner (imho).

96% test coverage and functional examples are included. However, it's
lightly tested, so feedback and bug reports are appreciated.

Enjoy (hopefully) :)

https://github.com/demianbrecht/django-sanction

(Will be released on PyPi shortly)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Nullable User email

2012-08-09 Thread Demian Brecht
Thanks for the feedback guys..

What I ended up doing was adding the following lines to my models module:

from django.contrib.auth.models import User as BaseUser

BaseUser._meta.get_field("username")._unique = False
BaseUser._meta.get_field("email").null = True

Melvin: I tried your suggestion and it worked like a charm for the email 
field. However, it didn't work for the username. I'm assuming that ORM 
introspection during syncdb doesn't use an instantiated model and as such, 
the "UNIQUE" attribute was still applied to the auth User model. Doing it 
this way allows me to override the default behavior during database 
creation.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/QOjT9MzLOrEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Nullable User email

2012-08-07 Thread Demian Brecht
Thanks for the quote, was unaware of the convention.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/mxg72KZaS8EJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Nullable User email

2012-08-07 Thread Demian Brecht
In an authentication backend I'm currently writing, I've supplied a custom
User model that extends the contrib.auth User model. I have the need to
allow email addresses to be NULL.

A little context: I'm writing an OAuth2 wrapper for an OAuth2 client I
relatively recently wrote (yes, I know that there are other clients already
written out there, but I'm writing this one due to being quite partial to
my module ;)). Some OAuth2 providers don't provide user e-mail addresses,
regardless of scope params. All providers however, provide some form of a
user ID. As you can't simply use field hiding in Django models, I figure
that I can achieve this by one of the following two methods:

1. Copy/paste the entire model, changing the attribute of the one field.
2. User._meta.fields[4].null = true

#2, even though seemingly hacky at best seems to be the lesser of the two
evils as it at least keeps things DRY (and is potentially far less
maintenance down the road).

My question is, is there another method of achieving this that I'm not
seeing? Preferably one that *isn't* hacky?

Thanks,
Demian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Noob question

2012-08-02 Thread Demian Brecht
What, exactly are you confused about? What is your question?

2012/8/2 Robert 

> Hi all, I´ve developed that model, but i´m quite confused about the
> sintax, looks a bit freaky... Hers my code:
>
> from django.db import models
>
> ##
>  PROJETOS 
> ##
>
> class Projetos(models.Model):
>
> #PRIMARY KEY
> i_id = models.AutoField(primary_key=True)
>
> #FIELDS
> i_motivo_oferta = models.IntegerField()
> s_nome_projeto = models.CharField("Projeto",max_length=100)
> s_integrador = models.CharField("Integrador",max_length=100)
> s_contend_provider = models.CharField("Contend
> Provider",max_length=100)
> s_marca_servico = models.CharField("Marca do
> Serviço",max_length=100)
>
> ABRANGENCIA = (('R', 'Regional'),('N', 'Nacional'),)
> s_abrangencia = models.CharField("Abrangência",max_length=2,
> choices=ABRANGENCIA)
>
> TIPO_SERVICO = (('C', 'Cross'),('W', 'White Label'),)
> i_id_tipo_servico =  models.CharField("Tipo de
> Serviço",max_length=2, choices=TIPO_SERVICO)
>
> i_valor_retry = models.IntegerField("Valor de retry")
> i_la =  models.IntegerField("Large account")
> d_lanc_comercial = models.DateField("Lançamento comercial")
> d_term_projeto = models.DateField("Término do projeto")
>
> ???
> ??? PLANOS_DE_MIDIA = (('I', 'Internet'), ('T', 'TV'), ('R',
> 'Radio'), ('R', 'Revista'), ('R', 'Midia Exterior'), ('R', 'Outros'),)
> ??? i_plan_midia = models.CharField("Plano de midia",max_length=2,
> choices=PLANOS_DE_MIDIA)
> ???
>
> d_data_acordo = models.DateField("Data de Acordo")
> d_data_revisao = models.DateField("Data de Revisão")
> i_ura_id =  models.IntegerField("URA ID")
> s_ura_desc = models.CharField("Descição URA",max_length=200)
>
> #FOREIGN KEY "Perfil_Servico"
> i_id_perfil_servico = models.ForeignKey(Perfil_Servico)
>
>
>
> ###
>   RELAÇÕES N -> 1  COM A TABELA PROJETOS  #
> ###
>
> # Para cada "PROJETO" eu tenho varios Header Enrichment #
> class Header_Enrich(models.Model):
> #PRIMARY KEY
> i_id = models.AutoField(primary_key=True)
> #FIELDS
> s_url = models.URLField("Url")
> b_wap = models.BooleanField("Wap")
> b_web = models.BooleanField("Web")
> #FOREIGN KEY "Projetos"
> i_id_projetos = models.ForeignKey(Projetos)
>
> # Para cada "PROJETO" eu tenho varias estimativas de trafego/receita
> para cada mes do ano. #
> class Traf_Receita(models.Model):
> #PRIMARY KEY
> i_id = models.AutoField(primary_key=True)
> #FIELDS
> i_mes = models.IntegerField("Mês")
> i_ano = models.IntegerField("Ano")
> i_trafego = models.IntegerField("Trafego")
> i_receita = models.IntegerField("Receita")
> #FOREIGN KEY "Projetos"
> i_id_projetos = models.ForeignKey(Projetos)
>
> # Para cada "PROJETO" eu tenho varias tarifas e descrições. #
> class Tarifar_Proj(models.Model):
> #PRIMARY KEY
> i_id = models.AutoField(primary_key=True)
> #FIELDS
> i_tarifa_proj = models.IntegerField("Tarifa")
> s_desc_tarifa = models.CharField("Descrição da tarifa",
> max_length=200)
> #FOREIGN KEY "Projetos"
> i_id_projetos = models.ForeignKey(Projetos)
>
> # Para cada "PROJETO" eu tenho varios planejamentos de midia. #
> class Planej_Midia(models.Model):
> #PRIMARY KEY
> i_id = models.AutoField(primary_key=True)
> #FIELDS
> s_planej_midea = models.CharField("Planejamento de midia",
> max_length=200)
> s_desc_midea = models.CharField("Descrição", max_length=200)
> #FOREIGN KEY "Projetos"
> i_id_projetos = models.ForeignKey(Projetos)
>
> ###
> ###  TABELAS FATO   ###
> ###
>
> """
> # Relaciona Projeto com Tipo de Servico
> class Rel_Proj_Tipo_Servico(models.Model):
> #PRIMARY KEY
> i_id = models.AutoField(primary_key=True)
> #FOREIGN KEY "Projetos" && "Motivo_Oferta"
> i_id_projetos = models.ForeignKey(Projetos)
> i_id_tipo_servico = models.ForeignKey(Tipo_Servico)
> """
>
> # Relaciona Projeto com motivo da oferta
> class Rel_Proj_Motivo(models.Model):
> #PRIMARY KEY
> i_id = models.AutoField(primary_key=True)
> #FOREIGN KEY "Projetos" && "Motivo_Oferta"
> i_id_projetos = models.ForeignKey(Projetos)
> i_id_motivo_oferta = models.ForeignKey(Motivo_Oferta)
>
> ###
> #

Re: Best Beginning Tutorial for Django 1.4

2012-07-27 Thread Demian Brecht
First off, I think a good question to ask is *why* do you want to learn
Django very deeply? Do you want to become a contributor to the project or
do you want to be a user? If you want to be a user, then I'd recommend
against getting too deep in Django (at least until it's absolutely
necessary). There are many other people who are dedicated to the project
and solving your problems for you. Concentrate on getting sh** done.
Learning the internals of Django (more times than not) will hold you back
in doing that.

However, if you *want* to contribute to the project (disclaimer: I'm not a
contributor.. Yet ;)):

* Focus on learning Python. Without a (relatively) solid grasp on the
language, many parts of Django internals will pass over your head.
* Read the intro Django documentation (settings up a project, etc). Play
with a sample project and play with various features. Get your head wrapped
around the framework as a user from end to end.
* Pick a feature at a time that you want to learn more about. Stick a
breakpoint in the entry points using pdb and step through the entire
system. Nothing gives you better insight into a system than watching it at
work.
* Scour the bug list. If there are any unassigned to that particular thing
that you've learned, try fixing it and submitting a patch.
* Pick another feature, rinse and repeat.



On Fri, Jul 27, 2012 at 11:53 AM, ACK-Django wrote:

> hello, guys i m new to django as well as python.
> i know its important to learn python before django
> so just an hour ago i finished the book =>
> http://www.swaroopch.org/notes/Python ( A Byte of Python 2.xx version )
> now i wanted to learn django very deeply and along the way i will also
> look at python.
>
> So People give me all links / tutorials / videos / blogs / documentation
> etc for Django 1.4
>
> only thing i find updated is documentation.
>
> so guys any newbie books / word of caution / general advice from your
> experience to newbie
>
> please share it here.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/4MPatJ7grhcJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



RE: Can't use admin with apache

2012-07-18 Thread Demian Brecht
No worries, happens to the best of us.

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
On Behalf Of Matt Smith
Sent: Wednesday, July 18, 2012 4:54 PM
To: django-users@googlegroups.com
Subject: Re: Can't use admin with apache

On 19/07/12 11:06, Demian Brecht wrote:
> You're running ls -l under your user account. The apache process needs 
> r+w permissions to the database file.

Thx Demian my issue is now resolved (and I feel like a dumbass but who
cares!)


-- 
Matt Smith
http://mattsmith.org.nz

-- 
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



RE: Can't use admin with apache

2012-07-18 Thread Demian Brecht
You're running ls -l under your user account. The apache process needs r+w
permissions to the database file.

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
On Behalf Of Matt Smith
Sent: Wednesday, July 18, 2012 3:59 PM
To: django-users@googlegroups.com
Subject: Re: Can't use admin with apache

On 19/07/12 06:27, Demian Brecht wrote:
> What does your Apache log look like? What, exactly, is the 500?
 mod_wsgi (pid=18094): Exception occurred processing WSGI script
'/usr/local/django/dogscience/apache/django.wsgi'.
 Traceback (most recent call last):
 ...
 File
"/usr/lib/pymodules/python2.6/django/db/backends/sqlite3/base.py", line 200,
in execute
 return Database.Cursor.execute(self, query, params)
 DatabaseError: attempt to write a readonly database

 mds@waitaki:/usr/local/django/dogscience$ ls -l sqlite3
 -rw-r--r-- 1 mds staff 47104 Jul 18 17:41 sqlite3

Change:

 mds@waitaki:/usr/local/django/dogscience$ ls -l sqlite3
 -rw-rw-rw- 1 www-data www-data 47104 Jul 18 17:41 sqlite3 -

Now instead of

 DatabaseError: attempt to write a readonly database

I get

 DatabaseError: unable to open database file

Maybe I'll try a different db what do you think?

> A common issue when deploying is if your fcgi or wsgi script doesn't 
> have the correct permissions set, which would cause an error that 
> can't be caught by Django.
 mds@waitaki:/usr/local/django/dogscience$ ls -l apache/django.wsgi
 -rw-r--r-- 1 mds staff 1630 Jul 18 17:38 apache/django.wsgi


How about this:

Is anyone out there deploying on debian squeeze with the following packages:
 apache2
 libapache2-mod-wsgi
 python-django

If so, does the admin work for you?

If it does, what db are you using?


--
Matt Smith
http://mattsmith.org.nz

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



RE: Can't use admin with apache

2012-07-18 Thread Demian Brecht
What does your Apache log look like? What, exactly, is the 500?

A common issue when deploying is if your fcgi or wsgi script doesn't have
the correct permissions set, which would cause an error that can't be caught
by Django.

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
On Behalf Of Matt Smith
Sent: Monday, July 16, 2012 10:24 PM
To: django-users@googlegroups.com
Subject: Can't use admin with apache

Background: I work on my projects using apache2 on my desktop machine, then
just rsync across to the actual server (also apache2), that way I thought I
could avoid the hassle of having things work with the dev server, but not
with apache. Not so. Today I've discovered that the admin works under the
dev server, but not with my apache setup. I replicated this using a brand
new helloWorld project. I've searched the archives, the docs, the book, also
ordinary web search. Found some people had similar problems and fixed it
with apache Alias directives pointing ADMIN_MEDIA_PREFIX to
DJANGO_SRC/contrib/admin/media but this didn't work for me. I get a 500
internal server error, regardless of DEBUG.

Appreciate any help with this.

--
Matt Smith
http://mattsmith.org.nz

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: App authoring: setup

2012-07-11 Thread Demian Brecht
Perhaps I wasn't clear.. When I mentioned installing, I meant installing
the Django app in a virtualenv through a setup script so that the project
has visibility to it (not installing the example project itself).

Was just curious if there was another method I was unaware of is all really.

Thanks for the link to tox. I'd forgotten about that for this particular
project.

On Wed, Jul 11, 2012 at 6:58 PM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> On Thu, Jul 12, 2012 at 9:00 AM, Demian Brecht 
> wrote:
> > Only a couple small problems with that:
> >
> > * No sample code for people utilizing the app in their own projects
>
> Really? You can't do what every other popular Django app on github
> does, and put an examples directory in your repository that isn't
> installed as part of setup.py?
>
> > * Unit testing environment is a little more unorthodox to set up - rather
> > than just using the example project's settings (and manage.py test
> > app_name), I'd have to do the configuration manually (AFAIK, I haven't
> > looked into this too much).
>
> A little more unorthodox, but not that hard to do. This is what Tox is
> designed to do.
>
> http://tox.testrun.org/latest/
>
> Yours,
> Russ Magee %-)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: App authoring: setup

2012-07-11 Thread Demian Brecht
Only a couple small problems with that:

* No sample code for people utilizing the app in their own projects
* Unit testing environment is a little more unorthodox to set up - rather
than just using the example project's settings (and manage.py test
app_name), I'd have to do the configuration manually (AFAIK, I haven't
looked into this too much).

On Wed, Jul 11, 2012 at 4:39 PM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:
>
> It seems to me that you've missed an obvious third option -- keep the
> two completely separate.
>
> Consider -- you can install apps using pip. Some of these apps will be
> formal distributions; others are just git/hg repository references.
> The only thing that binds them together is that they're isolated,
> standalone apps that can be deployed into any project you want.
>
> If I've understood your problem statement, it sounds like that's
> exactly what you want to do.
>
>  * Create an app.
>  * git init from the app root
>  * Create a setup.py for your app
>  * In a completely separate directory, create a project
>  * git init in that project
>  * set up requirements for that project that install your app into the
> project
>
> This way, you end up with 2 repositories -- one for your app, and one
> for your project. Your project will have very little content in it --
> it's just an integration layer for the apps (both self-authored and
> external) that you want in your project.
>
> Yours,
> Russ Magee %-)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



App authoring: setup

2012-07-11 Thread Demian Brecht
Hi all,

Is there a preferred method to create an app such that the app is the focal 
point and not the project? The app root is SCM root and it intended to be 
published on PyPI. I see one of two way to go about this:

First method (my preferred):
* Create an app at the root level of a project, using virtualenv
* git init from the app root
* Using setuptools (and setup.py for the app), install the app
* Create an example project in the app directory

Second method:
* Create a project
* Create an app for the project
* git init from the app directory
* Create a redundant example project

Thoughts?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/2Gn0ZkKJanYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



RE: migration via south for inheritance change -> please help

2012-07-04 Thread Demian Brecht
I'm not a South expert, but I'd assume you'd do this via south data
migrations
(http://south.readthedocs.org/en/latest/tutorial/part3.html#data-migrations)
.

You'd create:
- One (auto) migration script to create the Base table and new columns in
Foo and Bar
- A data migration script to migrate the current data set from Foo and Bar
into Base and fill in the OneToOneField keys accordingly
- A final (auto) migration script to remove the transferred fields from Foo
and Bar

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
On Behalf Of Lachlan Musicman
Sent: Wednesday, July 04, 2012 1:18 PM
To: django-users@googlegroups.com
Subject: Re: migration via south for inheritance change -> please help

I'd like to know this too - but I think the real answer is "get better at
python" - you are essentially (from what I can tell) in a django shell when
south pops the "not blank, not null but no data" error - try pulling in some
details from fixtures?

cheers
L.

On Thu, Jul 5, 2012 at 2:30 AM, Daniel Walz  wrote:
> ...no one?
>
> regards, mcJack
>
> 2012/7/2 mcJack :
>> Hi all,
>>
>> I've got a problem migrating some changes in the model, so I tried to 
>> solve it with south.
>> The situation:
>> I implemented two classes, which share some functionality. Now that I 
>> improved a little with python, django and co. I wanted to use 
>> inheritance for that issue.
>> The model looks like this:
>>
>> class Foo(models.Model):
>> eggs = models.TextField( null=True, blank=True )
>> plants = models.TextField( null=True, blank=True )
>> carpet = models.IntegerField()
>>
>> class Bar(models.Model):
>> eggs = models.TextField( null=True, blank=True )
>> plants = models.TextField( null=True, blank=True )
>> car = models.IntegerField()
>>
>>
>> And obviously I want to transform to:
>> class Base(models.Model):
>> eggs = models.TextField( null=True, blank=True )
>> plants = models.TextField( null=True, blank=True )
>>
>> class Foo(models.Model):
>> base = models.OneToOneField( 'Base', parent_link=True )
>> carpet = models.IntegerField()
>>
>> class Bar(models.Model):
>> base = models.OneToOneField( 'Base', parent_link=True )
>> car = models.IntegerField()
>>
>> But how can I tell south to fill the super class with the data from 
>> the old schema?
>>
>> Can I add this information manually in the created migration script? 
>> or is there an option/switch I didn't notice?
>>
>> Any hints are very welcome, thanks a lot
>>
>> mcJack
>>
>> --
>> You received this message because you are subscribed to the Google 
>> Groups "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/_6CYJ1yqh-sJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>
>
>
> --
> Daniel Walz - mcj...@gmail.com
> Bremen, Germany
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.