I have followed the geodjango installation(windows XP) and tutorial to perfection I am running django 1.2 When I get to syncdb and run I receive the following.
raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured:'django.db.backends.postgis' isn
an available database backend.
Try using django.db.backends.XXX, where XXX is one of:
'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3
Error was: No module named postgis.base
I tried changing to 'django.db.backends.postgresql_psycopg2' as an alternative But then I receive this response:
AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'
When I try posgresql:
**raise ImproperlyConfigured("Error loading psycopg module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg module: No mo
dule named psycopg**
Is it not supposed to be postgis which I successful downloaded and installed? why isn’t it working? I am new and I am trying to learn so any help would be greatly appreciated.
The problem is, in settings.py
'django.db.backends.postgis'
it is supposed to be
django.contrib.gis.db.backends.postgis
that should do it.
I experienced this same error on Mac OS X 10.6 after I followed the instructions on the geodjango site and installed packages using Homebrew. Apparently, the Geodjango documentation gave some incorrect/outdated instructions about how to install it. To make Geodjango work, I followed several steps:
Right now, GeoDjango 1.4 does not play nice with PostGIS 2.0 (which is the version Homebrew installed when I followed the instructions in the GeoDjango documentation). So, I needed to install PostGIS 1.5. I did this using the following Terminal commands (for this to work, you must have Homebrew installed):
brew tap homebrew/versions
brew install postgis15
brew untap homebrew/versions
PostGIS 1.5 doesn't play nice with PostGreSQL 9.2 (which is the version Homebrew installed when I followed the Geodjango documentation's instructions). So, I installed PostGreSQL 9.1. I forget exactly what Homebrew commands I used to install PostGreSQL 9.1, but they should be similar to the previous step.
In my case the prior steps weren't sufficient to get Geodjango operational. When I tried to run 'syncdb' in Django again, I discovered a new error in Terminal:
django.core.exceptions.ImproperlyConfigured: Error loading psycopg module:
No module named psycopg
I initially thought my copy of psycopg2 and PostgreSQL9.1 were not on my PYHTONPATH, so I added them. I also fiddled around to make sure django was running PostgreSQL 9.1 instead of 9.2. I used 'initdb /usr/local/var/postgres'.
Then I needed to do some database configuration. I set up a template in PostGIS and set up a "role" (/user) for the database. To do this, I followed the instructions in the Geodjango documentation. I received numerous errors, but Googled them and found solutions pretty easily.
Then GeoDjango started working properly!
This source was the most helpful one I found and links to other helpful urls that cover some of these issues in more detail: http://pragmaticstartup.wordpress.com/2012/09/26/installing-django-postgis-postgres-on-os-x-version-hell/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With