I'm running Django 1.8.4 on a Webfaction shared host, and I need to enable GeoDjango. These are the steps I took:
Ran ./manage.py migrate
. Here's the error:
django.db.utils.OperationalError: could not open extension control file "/usr/pgsql-9.1/share/extension/postgis.control": No such file or `directory
There is a simple, horrible way to get this working. Specify the following setting as the same name as your webfaction database:
# settings.py
...
POSTGIS_TEMPLATE = 'my_database_name'
Now ./manage.py migrate
should work as normal.
The reason for this error is because Django thinks that PostGIS is not installed on the database, and is attempting to install it as an extension, PostGIS 2 style.
The test it performs is to see if the PostGIS database template is present. If it isn't, it attempts to install it in a way that is incompatible with PostGIS < 2 (which is what is installed on Webfaction).
By changing this setting, Django checks to see if the normal database is present (instead of the PostGIS template) and then concludes that everything is set up correctly - which it is. The wrong test, but the right result.
If you're curious as to what exactly is going on, have a look at django.contrib.gis.db.backends.postgis.base.DatabaseWrapper
.
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