geodesign / django-raster

Django-raster allows you to create tiled map services (TMS) and raster map algebra end points for web maps. It is Python-based, and requires GeoDjango with a PostGIS backend.
BSD 3-Clause "New" or "Revised" License
96 stars 39 forks source link

ImportError: No module named 'utils' adding raster app to settings.py #7

Closed enricofer closed 8 years ago

enricofer commented 8 years ago

I succesfully installed django_raster with pip Then I add 'raster' to installed_apps but starting server (django 1.9 on Ubuntu 14.04) I get the following exception:

Unhandled exception in thread started by <function check_errors..wrapper at 0x7f23e2d3e950> Traceback (most recent call last): File "/home/enrico/.env/lib/python3.4/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(_args, *_kwargs) File "/home/enrico/.env/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run autoreload.raise_last_exception() File "/home/enrico/.env/lib/python3.4/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception six.reraise(__exception) File "/home/enrico/.env/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise raise value.with_traceback(tb) File "/home/enrico/.env/lib/python3.4/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(_args, kwargs) File "/home/enrico/.env/lib/python3.4/site-packages/django/init.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "/home/enrico/.env/lib/python3.4/site-packages/django/apps/registry.py", line 108, in populate app_config.import_models(all_models) File "/home/enrico/.env/lib/python3.4/site-packages/django/apps/config.py", line 202, in import_models self.models_module = import_module(models_module_name) File "/home/enrico/.env/lib/python3.4/importlib/init**.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 2254, in _gcd_import File "", line 2237, in _find_and_load File "", line 2226, in _find_and_load_unlocked File "", line 1200, in _load_unlocked File "", line 1129, in _exec File "", line 1471, in exec_module File "", line 321, in _call_with_frames_removed File "/home/enrico/.env/lib/python3.4/site-packages/raster/models.py", line 11, in from raster.fields import RasterField File "/home/enrico/.env/lib/python3.4/site-packages/raster/fields.py", line 3, in from raster.ogrraster import OGRRaster File "/home/enrico/.env/lib/python3.4/site-packages/raster/ogrraster.py", line 7, in from utils import convert_pixeltype, HEADER_STRUCTURE, HEADER_NAMES,\ ImportError: No module named 'utils'

enricofer commented 8 years ago

in line 7, simply putting dot before utils resolvs: from .utils import convert_pixeltype, HEADER_STRUCTURE, HEADER_NAMES,

yellowcap commented 8 years ago

@enricofer thanks for reporting this. Unfortunately the last version available on pypi is out of date. The package has changed a lot since then. For instance, I included the ogrraster module into Django itself, see

https://docs.djangoproject.com/en/1.9/ref/contrib/gis/gdal/#raster-data-objects https://docs.djangoproject.com/en/1.9/ref/contrib/gis/model-api/#rasterfield https://docs.djangoproject.com/en/1.9/ref/contrib/gis/db-api/#creating-and-saving-models-with-raster-fields

So i would recommend to install directly from master until the next release

 pip install git+https://github.com/geodesign/django-raster.git@master

I use the master branch of the package in my project and it works fine, but I am still working towards a new release. I want to document things better before that.

enricofer commented 8 years ago

Well, I will do that. Thanks.