views:

261

answers:

2

As soon as I add "from django.contrib.gis.db import models" instead of "from django.db import models", Django stops recognizing the app and gives this error:

Error: App with label location could not be found. Are you sure your INSTALLED_APPS setting is correct?

The error goes away as soon as I comment out "from django.contrib.gis.db import models"...

I have added "django.contrib.gis" and the "location" app to the INSTALLED_APPS setting correctly.

Any clues why this is happening? I am running using Django v1.1.1 final, on my windows laptop.

A: 

If you have location on your INSTALLED_APPS and are getting this error, most likely you don't have the location app in your PYTHONPATH.

celopes
"location" app should be on the PYTHONPATH otherwise why would it work fine when I use "from django.db import models" instead of "from django.contrib.gis.db import models"...
akv
A: 

I had encountered the same issue using Postgres 8.4

Links to psycopg2 and GeoDjango given on geodjango installation instructions page rely on Postgres 8.3,

so if you use Postgres 8.4 you must install appropriate version of psycopg2 from http://www.stickpeople.com/projects/python/win-psycopg/

also GeoDjango installer modifies the system Path environment variable to include C:\Program Files\PostgreSQL\8.3\bin.

in case of Postgres 8.4 you must change Path variable to C:\Program Files\PostgreSQL\8.4\bin.

After performing these modifications all must work fine :)

msqui