#21547: GeoDjango admin throws ProgrammingError after following the tutorial
-------------------------------------+-------------------------------------
Reporter: awilliams@… | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 1.6
Severity: Normal | Resolution:
Keywords: geodjango, gis, | Triage Stage: Accepted
postgis 2.0 |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by bjoh-01):
I am having the same problem 9 years later. Sorry if this has been fixed,
but I am having trouble finding the solution.
I am using POSTGIS 3.0, django 4.2.1.
Traceback:
{{{
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/core/management/__init__.py", line 442, in
execute_from_command_line
utility.execute()
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/core/management/base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/core/management/base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/core/management/commands/migrate.py", line 356, in handle
post_migrate_state = executor.migrate(
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/migrations/executor.py", line 135, in migrate
state = self._migrate_all_forwards(
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/migrations/executor.py", line 167, in
_migrate_all_forwards
state = self.apply_migration(
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/migrations/executor.py", line 252, in apply_migration
state = migration.apply(state, schema_editor)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/migrations/migration.py", line 132, in apply
operation.database_forwards(
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/migrations/operations/models.py", line 96, in
database_forwards
schema_editor.create_model(model)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/backends/base/schema.py", line 451, in create_model
self.execute(sql, params or None)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/backends/postgresql/schema.py", line 45, in execute
return super().execute(sql, params)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/backends/base/schema.py", line 201, in execute
cursor.execute(sql, params)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/backends/utils.py", line 102, in execute
return super().execute(sql, params)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/vboxuser/Desktop/django/lib/python3.8/site-
packages/django/db/backends/utils.py", line 87, in _execute
return self.cursor.execute(sql)
django.db.utils.ProgrammingError: type "geometry" does not exist
LINE 1: ...OT NULL, "lat" double precision NOT NULL, "mpoly" geometry(M...
}}}
There is no longer a sqlall command, but running python manage.py
sqlmigrate world 0001 yields:
{{{
BEGIN;
--
-- Create model WorldBorder
--
CREATE TABLE "world_worldborder" ("id" bigint NOT NULL PRIMARY KEY
GENERATED BY DEFAULT AS IDENTITY, "name" varchar(50) NOT NULL, "area"
integer NOT NULL, "pop2005" integer NOT NULL, "fips" varchar(2) NULL,
"iso2" varchar(2) NOT NULL, "iso3" varchar(3) NOT NULL, "un" integer NOT
NULL, "region" integer NOT NULL, "subregion" integer NOT NULL, "lon"
double precision NOT NULL, "lat" double precision NOT NULL, "mpoly"
geometry(MULTIPOLYGON,4326) NOT NULL);
CREATE INDEX "world_worldborder_mpoly_6f181651_id" ON "world_worldborder"
USING GIST ("mpoly");
COMMIT;
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/21547#comment:7>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701886caf723d-52eeb25b-da9d-408f-8cc0-ecf701ea3668-000000%40eu-central-1.amazonses.com.