Weird model behavior in custom applications?

0 views
Skip to first unread message

Joshua Kramer

unread,
Nov 15, 2009, 6:10:18 PM11/15/09
to Pinax Users
Howdy Everyone!

After having installed a fresh version of Pinax 0.7.1, I have an
interesting problem with the behavior of Django when I try to install
custom applications.

In my main project directory, I've created an 'apps' directory, and
created some standard django skeleton apps. When I tried to run
'syncdb', I noticed the tables were not created for my models.

After some amount of tracing, I found out that Django is not
registering my apps, with my models. With skeleton models the apps
register fine. When I say 'register', I mean this: I detect if an app
is registered or not by doing this in manage.py:

from django.db import models
myApps = models.get_apps()

I then look through the myApps list to see if my apps are present. I
note that all of the Pinax apps are always present.

Here is an example. This model causes the app to not register:

-------
from django.conf import settings

from django.contrib.gis.db import models
from django.contrib.localflavor.us.models import USStateField

class Zipcode(models.Model):
code = models.CharField(max_length=10)
poly = models.PolygonField()
objects = models.GeoManager()

class Address(models.Model):
addrKey = models.CharField(max_length=32)
num = models.IntegerField()
street = models.CharField(max_length=128)
city = models.CharField(max_length=64)
state = USStateField()
zipcode = models.ForeignKey(Zipcode)
objects = models.GeoManager()
-----

This code allows the app to register:

----
from django.db import models
----

Has anyone seen this before?

Thanks,
-Josh

William Shallum

unread,
Nov 16, 2009, 7:42:28 PM11/16/09
to pinax...@googlegroups.com
There's some error with your imports, probably one of the libraries
that django.contrib.gis depends on.

Drop into the shell (manage.py shell) and try to import your app's
models module manually. This will show the exception.

skylar....@gmail.com

unread,
Nov 17, 2009, 7:29:20 AM11/17/09
to pinax...@googlegroups.com
So, you're saying that importing from gis doesn't register?

...
Reply all
Reply to author
Forward
0 new messages