[Solved]-My PostGIS database looks fine but GeoDjango thinks otherwise… why?

18👍

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.

5👍

Whenever I’ve got this error in a similar situation (i.e. when the database seems to be a perfectly valid PostGIS database) it has turned out that there’s been an error in DATABASES in settings.py. It’s actually authentication when connecting to the database failing, but it just happens that the first thing that touches the database when starting up my GeoDjango project is the postgis_lib_version call from django/contrib/gis/db/backends/postgis/operations.py

1👍

I had the same issue a couple months ago. I had to recreate the template_database and the main db again. From this link.

Leave a comment