I'm trying to set up a GeoDjango app to test an earlier problem I was having. I've set up a postgresql database, created a new Django project and app, but when I try ./manage.py syncdb
I get this:
django.core.exceptions.ImproperlyConfigured: Cannot determine PostGIS version for database "django_geotest". GeoDjango requires at least PostGIS version 1.3. Was the database created from a spatial database template?
Which I don't understand as I've previously been through all the installation of GeoDjango's requirements, and created this django_geotest
database by doing this:
$ createdb -T template_postgis django_geotest
And it looks like the database is correctly set up:
django_geotest=# SELECT PostGIS_full_version();
postgis_full_version
-------------------------------------------------------------------------------------------------------
POSTGIS="1.5.3" GEOS="3.2.2-CAPI-1.6.2" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.3" USE_STATS
(1 row)
Describing the database, I get this:
django_geotest=# \d
List of relations
Schema | Name | Type | Owner
--------+-------------------+-------+-------
public | geography_columns | view | phil
public | geometry_columns | table | phil
public | spatial_ref_sys | table | phil
(3 rows)
So now I'm stuck as to what to try next... My knowledge of postgresql and its templates etc isn't that great. Any ideas? Thanks.
PostGIS adds geographic object support to PostgreSQL, turning it into a spatial database. GEOS, PROJ and GDAL should be installed prior to building PostGIS. You might also need additional libraries, see PostGIS requirements.
I had the same problem with PostgreSQL 9.3 and PostGIS 2.1 installed on OS X 10.9.1 using homebrew.
For this particular issue, you only need to add this line:
POSTGIS_VERSION = ( 2, 1 )
using the comma separated number for your PostGIS version to settings.py
.
I'm not sure why, but Django's having trouble reading the version information from PostGIS.
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