GeoNode / geonode

GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data.
https://geonode.org/
Other
1.46k stars 1.13k forks source link

column base_region.bbox_x0 does not exist #2920

Closed kalxas closed 7 years ago

kalxas commented 7 years ago

I deployed master yesterday and when I try metadata details I get this error:

Environment:

Request Method: GET
Request URL: http://2c.terranodo.io/layers/geonode:med_ghs_built_lds1975_globe_r2016a_3857_38_v1_0/metadata_detail

Django Version: 1.8.17
Python Version: 2.7.12
Installed Applications:
('modeltranslation',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'django.contrib.sitemaps',
 'django.contrib.staticfiles',
 'django.contrib.messages',
 'django.contrib.humanize',
 'django.contrib.gis',
 'pagination',
 'taggit',
 'treebeard',
 'friendlytagloader',
 'geoexplorer',
 'geonode-client',
 'leaflet',
 'django_extensions',
 'autocomplete_light',
 'mptt',
 'djcelery',
 'storages',
 'pinax_theme_bootstrap_account',
 'pinax_theme_bootstrap',
 'django_forms_bootstrap',
 'account',
 'avatar',
 'dialogos',
 'agon_ratings',
 'announcements',
 'actstream',
 'user_messages',
 'tastypie',
 'polymorphic',
 'guardian',
 'oauth2_provider',
 'corsheaders',
 'floppyforms',
 'geonode.people',
 'geonode.base',
 'geonode.layers',
 'geonode.maps',
 'geonode.proxy',
 'geonode.security',
 'geonode.social',
 'geonode.catalogue',
 'geonode.documents',
 'geonode.api',
 'geonode.groups',
 'geonode.services',
 'geonode.geoserver',
 'geonode.upload',
 'geonode.tasks')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'pagination.middleware.PaginationMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')

Traceback:
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/GeoNode-2.7.dev20170216141423-py2.7.egg/geonode/layers/views.py" in layer_metadata_detail
  892.         'SITEURL': settings.SITEURL[:-1]
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/shortcuts.py" in render_to_response
  39.         content = loader.render_to_string(template_name, context, using=using)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/loader.py" in render_to_string
  99.         return template.render(context, request)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/backends/django.py" in render
  74.         return self.template.render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in render
  210.                     return self._render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in _render
  202.         return self.nodelist.render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in render_node
  919.         return node.render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  135.         return compiled_parent._render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in _render
  202.         return self.nodelist.render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in render_node
  919.         return node.render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  135.         return compiled_parent._render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in _render
  202.         return self.nodelist.render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in render_node
  919.         return node.render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  135.         return compiled_parent._render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in _render
  202.         return self.nodelist.render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in render_node
  919.         return node.render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in render_node
  919.         return node.render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/base.py" in render_node
  919.         return node.render(context)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  328.             if match:
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/db/models/query.py" in __nonzero__
  170.         return type(self).__bool__(self)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/db/models/query.py" in __bool__
  166.         self._fetch_all()
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/db/models/query.py" in _fetch_all
  965.             self._result_cache = list(self.iterator())
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/db/models/query.py" in iterator
  238.         results = compiler.execute_sql()
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  840.             cursor.execute(sql, params)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  79.             return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/db/utils.py" in __exit__
  98.                 six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/ubuntu/venvs/state_2c_geonode/local/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /layers/geonode:med_ghs_built_lds1975_globe_r2016a_3857_38_v1_0/metadata_detail
Exception Value: column base_region.bbox_x0 does not exist
LINE 1: ...ase_region"."name_en", "base_region"."parent_id", "base_regi...
                                                             ^
simod commented 7 years ago

@afabiani could you take a look?

afabiani commented 7 years ago

Mmm, quite strange. Did you run makemigrations?

The fileds are defined here https://github.com/GeoNode/geonode/blob/master/geonode/base/migrations/24_to_26.py

And the initial_data.json has been updated with coordinates too.

kalxas commented 7 years ago

I already did python manage.py migrate

kalxas commented 7 years ago

this is a migrated site, so initial_data.json is not loaded

afabiani commented 7 years ago

maybe the 24_to_26.py has been marked as already applied. This should not happen on a new installation, but maybe on a migrated one yes.

A possible solution would be to run a python manage.py makemigrations, but maybe you need to remove the bbox fields declararion from 24_to_26.py first.

About the bboxes of the regions, it should not a big issue to have them empy. The side effect is that the md editor won't provide you default values when you create a new Layer.

kalxas commented 7 years ago

I added the missing columns manually. Besides bbox_x0, bbox_x1, bbox_y0, bbox_y1 srid is also missing.

simod commented 7 years ago

is this still valid? Can we consider it as fixed?

kalxas commented 7 years ago

well, I had to manually add this column in the migration process, but yes, lets close this issue