I pulled down a GeoDjango application today and ran into this issue.
django.core.exceptions.ImproperlyConfigured: ‘django.contrib.gis.db.backends.postgis’ isn’t an available database backend.
Try using django.db.backends.XXX, where XXX is one of:
‘dummy’, ‘mysql’, ‘oracle’, ‘postgresql_psycopg2’, ‘sqlite3’
Error was: No module named psycopg2.extensions
If you run into this error just follow the steps and hopefully you’ll be on your way in no time.
- First make sure you have added ‘django.contrib.gis’, to your INSTALLED_APPS in your settings.py file.
- Secondly make sure you have set your DATABASE engine in your settings.py to ‘django.contrib.gis.db.backends.postgis’,
- Lastly make sure you have psycopg2 installed. Install it by running
pip install psycopg2
You’ll probably need to install the dependencies for compiling psycopg2. You can do so by running
sudo apt-get install python-dev postgresql-server-dev-all
That should be it.