Given that we already calculate a `HAS_GEOS` variable, it would not be
hard to issue a clearer message.
Here is an example of a new user being led quite a ways down a rabbit-hole
by the confusing message:
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg
/django-users/W3IBOBTQMyU/3F8xBVMAwsYJ
--
Ticket URL: <https://code.djangoproject.com/ticket/23873>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* 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>
Comment (by carljm):
Yep, that looks pretty reasonable to me.
--
Ticket URL: <https://code.djangoproject.com/ticket/23873#comment:2>
Comment (by carljm):
Created a pull request (https://github.com/django/django/pull/3581) just
to get CI verification that this doesn't break anything.
--
Ticket URL: <https://code.djangoproject.com/ticket/23873#comment:3>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"d2bcb0598058dd93eac94bdbb7dd2565cff0abea"]:
{{{
#!CommitTicketReference repository=""
revision="d2bcb0598058dd93eac94bdbb7dd2565cff0abea"
Fixed #23873 -- Improved GIS error message when GEOS is not installed.
Thanks Claude for writing the patch.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23873#comment:4>