#23873: Trying to import GIS without GEOS installed leads to obscure error
message
--------------------------------------+------------------------------------
Reporter: carljm | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by claudep):
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
Maybe something like that:
{{{
#!diff
diff --git a/django/contrib/gis/db/models/__init__.py
b/django/contrib/gis/db/models/__init__.py
index 835e907..9be4a18 100644
--- a/django/contrib/gis/db/models/__init__.py
+++ b/django/contrib/gis/db/models/__init__.py
@@ -1,6 +1,15 @@
+from django.core.exceptions import ImproperlyConfigured
+
# Want to get everything from the 'normal' models package.
from django.db.models import * # NOQA
+from django.contrib.gis.geos import HAS_GEOS
+
+if not HAS_GEOS:
+ raise ImproperlyConfigured(
+ "GEOS is required and has not been detected. Are you sure it is
installed? "
+ "See also
https://docs.djangoproject.com/en/stable/ref/contrib/gis/install/geolibs/")
+
# Geographic aggregate functions
from django.contrib.gis.db.models.aggregates import * # NOQA
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23873#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.d8333001eb38837af22b59a612c5c7b7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.