Changes between Initial Version and Version 1 of Ticket #21547, comment 6


Ignore:
Timestamp:
May 30, 2023, 7:44:11 AM (18 months ago)
Author:
bjoh-01

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21547, comment 6

    initial v1  
    11I am having the same problem 9 years later. Sorry if this has been fixed, but I am having trouble finding the solution.
    22
    3 I am using POSTGIS 3.0, django 4.2.1.
    4 
    5 Traceback:
    6 
    7 {{{
    8 
    9 Traceback (most recent call last):
    10   File "manage.py", line 22, in <module>
    11     main()
    12   File "manage.py", line 18, in main
    13     execute_from_command_line(sys.argv)
    14   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    15     utility.execute()
    16   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/core/management/__init__.py", line 436, in execute
    17     self.fetch_command(subcommand).run_from_argv(self.argv)
    18   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/core/management/base.py", line 412, in run_from_argv
    19     self.execute(*args, **cmd_options)
    20   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/core/management/base.py", line 458, in execute
    21     output = self.handle(*args, **options)
    22   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/core/management/base.py", line 106, in wrapper
    23     res = handle_func(*args, **kwargs)
    24   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 356, in handle
    25     post_migrate_state = executor.migrate(
    26   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/db/migrations/executor.py", line 135, in migrate
    27     state = self._migrate_all_forwards(
    28   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
    29     state = self.apply_migration(
    30   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
    31     state = migration.apply(state, schema_editor)
    32   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/db/migrations/migration.py", line 132, in apply
    33     operation.database_forwards(
    34   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/db/migrations/operations/models.py", line 96, in database_forwards
    35     schema_editor.create_model(model)
    36   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 451, in create_model
    37     self.execute(sql, params or None)
    38   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/db/backends/postgresql/schema.py", line 45, in execute
    39     return super().execute(sql, params)
    40   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 201, in execute
    41     cursor.execute(sql, params)
    42   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/db/backends/utils.py", line 102, in execute
    43     return super().execute(sql, params)
    44   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
    45     return self._execute_with_wrappers(
    46   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    47     return executor(sql, params, many, context)
    48   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
    49     return self.cursor.execute(sql, params)
    50   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/db/utils.py", line 91, in __exit__
    51     raise dj_exc_value.with_traceback(traceback) from exc_value
    52   File "/home/vboxuser/Desktop/django/lib/python3.8/site-packages/django/db/backends/utils.py", line 87, in _execute
    53     return self.cursor.execute(sql)
    54 django.db.utils.ProgrammingError: type "geometry" does not exist
    55 LINE 1: ...OT NULL, "lat" double precision NOT NULL, "mpoly" geometry(M...
    56 
    57 }}}
    58 
    59 
    60 There is no longer a `sqlall` command, but running `python manage.py sqlmigrate world 0001` yields:
    61 
    62 
    63 {{{
    64 BEGIN;
    65 --
    66 -- Create model WorldBorder
    67 --
    68 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);
    69 CREATE INDEX "world_worldborder_mpoly_6f181651_id" ON "world_worldborder" USING GIST ("mpoly");
    70 COMMIT;
    71 }}}
    72 
    73 
    74 
    75 Replying to [ticket:21547 awilliams@…]:
    76 > Hi guys. This is my first bug report so please let me know how I can improve it. I'm still new to the world of GeoDjango, but I did successfully upgrade an existing GeoDjango 1.5 application to 1.6 without any hiccups. I'm only seeing this problem when I create a '''new''' projects. This is using the default Django 1.6 project and app structure.
    77 >
    78 >
    79 > == The Problem ==
    80 > The GeoDjango admin for the "world" app created in the GeoDjango tutorial throws a ProgrammingError:
    81 > {{{
    82 > ProgrammingError at /admin/world/worldborder/
    83 > column world_worldborder.geom does not exist
    84 > LINE 1: ...ld_worldborder"."lon", "world_worldborder"."lat", "world_wor...
    85 > }}}
    86 >
    87 > == Reproduce the problem ==
    88 > 1. Visit the GeoDjango tutorial for Django 1.6 https://docs.djangoproject.com/en/1.6/ref/contrib/gis/tutorial/
    89 >
    90 > 2. Create a database with GIS extensions https://docs.djangoproject.com/en/1.6/ref/contrib/gis/install/postgis/#creating-a-spatial-database-with-postgis-2-0-and-postgresql-9-1
    91 >
    92 > 3. Create the "world" app described https://docs.djangoproject.com/en/1.6/ref/contrib/gis/tutorial/#create-a-new-project
    93 >
    94 > 4. Follow the steps up to '''Put your data on the map'''. Run {{{ python manage.py runserver }}}.
    95 >
    96 > 5. Visit http://127.0.0.1:8000/admin/world/worldborder/ to see the error.
    97 >
    98 > == Notes ==
    99 > * Most of the tutorial works as described. it's only the admin section that throws an error.
    100 > * The output from {{{ python manage.py sqlall world }}} is different than the tutorial:
    101 > {{{#!sql
    102 > BEGIN;
    103 > CREATE TABLE "world_worldborder" (
    104 >     "id" serial NOT NULL PRIMARY KEY,
    105 >     "name" varchar(50) NOT NULL,
    106 >     "area" integer NOT NULL,
    107 >     "pop2005" integer NOT NULL,
    108 >     "fips" varchar(2) NOT NULL,
    109 >     "iso2" varchar(2) NOT NULL,
    110 >     "iso3" varchar(3) NOT NULL,
    111 >     "un" integer NOT NULL,
    112 >     "region" integer NOT NULL,
    113 >     "subregion" integer NOT NULL,
    114 >     "lon" double precision NOT NULL,
    115 >     "lat" double precision NOT NULL,
    116 >     "mpoly" geometry(MULTIPOLYGON,4326) NOT NULL
    117 > )
    118 > ;
    119 > CREATE INDEX "world_worldborder_mpoly_id" ON "world_worldborder" USING GIST ( "mpoly" );
    120 >
    121 > COMMIT;
    122 >
    123 > }}}
    124 > Output in tutorial: https://docs.djangoproject.com/en/1.6/ref/contrib/gis/tutorial/#run-syncdb
    125 >
    126 > == Development setup ==
    127 > * Ubuntu 12.10
    128 > * Python 2.7.3
    129 > * Django 1.6
    130 > * PostGIS 2.0.1
    131 > * PostgreSQL 9.1.10
    132 > * Virtualenvwrapper 4.1.1
    133 > * Virtualenv 1.10.1
    134 >
    135 > The stacktrace:
    136 > {{{
    137 > Environment:
    138 >
    139 >
    140 > Request Method: GET
    141 > Request URL: http://127.0.0.1:8000/admin/world/worldborder/
    142 >
    143 > Django Version: 1.6
    144 > Python Version: 2.7.3
    145 > Installed Applications:
    146 > ('django.contrib.admin',
    147 >  'django.contrib.auth',
    148 >  'django.contrib.contenttypes',
    149 >  'django.contrib.sessions',
    150 >  'django.contrib.messages',
    151 >  'django.contrib.staticfiles',
    152 >  'django.contrib.gis',
    153 >  'world')
    154 > Installed Middleware:
    155 > ('django.contrib.sessions.middleware.SessionMiddleware',
    156 >  'django.middleware.common.CommonMiddleware',
    157 >  'django.middleware.csrf.CsrfViewMiddleware',
    158 >  'django.contrib.auth.middleware.AuthenticationMiddleware',
    159 >  'django.contrib.messages.middleware.MessageMiddleware',
    160 >  'django.middleware.clickjacking.XFrameOptionsMiddleware')
    161 >
    162 >
    163 > Traceback:
    164 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
    165 >   114.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
    166 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
    167 >   430.                 return self.admin_site.admin_view(view)(*args, **kwargs)
    168 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
    169 >   99.                     response = view_func(request, *args, **kwargs)
    170 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
    171 >   52.         response = view_func(request, *args, **kwargs)
    172 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
    173 >   198.             return view(request, *args, **kwargs)
    174 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
    175 >   29.             return bound_func(*args, **kwargs)
    176 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
    177 >   99.                     response = view_func(request, *args, **kwargs)
    178 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
    179 >   25.                 return func(self, *args2, **kwargs2)
    180 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in changelist_view
    181 >   1409.             'selection_note': _('0 of %(cnt)s selected') % {'cnt': len(cl.result_list)},
    182 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/db/models/query.py" in __len__
    183 >   77.         self._fetch_all()
    184 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/db/models/query.py" in _fetch_all
    185 >   854.             self._result_cache = list(self.iterator())
    186 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/db/models/query.py" in iterator
    187 >   220.         for row in compiler.results_iter():
    188 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in results_iter
    189 >   710.         for rows in self.execute_sql(MULTI):
    190 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
    191 >   781.         cursor.execute(sql, params)
    192 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/db/backends/util.py" in execute
    193 >   69.             return super(CursorDebugWrapper, self).execute(sql, params)
    194 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/db/backends/util.py" in execute
    195 >   53.                 return self.cursor.execute(sql, params)
    196 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/db/utils.py" in __exit__
    197 >   99.                 six.reraise(dj_exc_type, dj_exc_value, traceback)
    198 > File "/home/aaron/Envs/development/local/lib/python2.7/site-packages/django/db/backends/util.py" in execute
    199 >   53.                 return self.cursor.execute(sql, params)
    200 >
    201 > Exception Type: ProgrammingError at /admin/world/worldborder/
    202 > Exception Value: column world_worldborder.geom does not exist
    203 > LINE 1: ...ld_worldborder"."lon", "world_worldborder"."lat", "world_wor...
    204 >                                                              ^
    205 > }}}
Back to Top