Opened 19 months ago

Closed 19 months ago

Last modified 19 months ago

#21504 closed Cleanup/optimization (fixed)

GeoDjango swallows connection errors as version failures

Reported by: paultag@… Owned by: bmispelon
Component: GIS Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

I'm getting a:

django.core.exceptions.ImproperlyConfigured: Cannot determine PostGIS version for database "glare". GeoDjango requires at least PostGIS version 1.3. Was the database created from a spatial database template?

but, when I look at the actual exception thrown by the version check:

./manage.py syncdbcould not connect to server: Connection refused

Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?

It'd be great to be slightly more smart about this :)

Change History (3)

comment:1 Changed 19 months ago by bmispelon

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to bmispelon
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Cleanup/optimization

The problem happens because we catch a wide range of errors when trying to determine the postgis version [1].

We could probably be smarter about what we catch.

[1] https://github.com/django/django/blob/master/django/contrib/gis/db/backends/postgis/operations.py#L261

comment:2 Changed 19 months ago by Baptiste Mispelon <bmispelon@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 17912522cee1277c8c126394fbe94b7172f92e83:

Fixed #21504 -- Don't shadow database errors when testing for postgis version.

Thanks to trac user paultag for the report.

comment:3 Changed 19 months ago by anonymous

Thanks for the fix, y'all!

Note: See TracTickets for help on using tickets.
Back to Top