0

I can't run "./manage.py evolve --hint --execute" for my GeoDjango project. It exits with error:

File "/home/viktor/.virtualenvs/senv/lib/python2.6/site-packages/django_evolution-0.6.7-py2.6.egg/django_evolution/db/__init__.py", line 18, in     __init__
module = __import__('.'.join(module_name),{},{},[''])
ImportError: No module named django.contrib.gis.db.backends.postgis

Here's the mutation hint:

from django_evolution.mutations import AddField, DeleteField
from django.contrib.gis.db.models.fields import PointField


MUTATIONS = [
    AddField('Geodata', 'position_real', PointField, initial=<<USER VALUE REQUIRED>>),
    AddField('Geodata', 'position', PointField, initial=<<USER VALUE REQUIRED>>),
    DeleteField('Geodata', 'real_lat'),
    DeleteField('Geodata', 'lat'),
    DeleteField('Geodata', 'lng'),
    DeleteField('Geodata', 'real_lng')
]
#----------------------
Trial evolution successful.

However, web app runs fine using *backends.postgis database engine. It seems to be a django-evolution problem only.

Any ideas how can I make evolution to work? Thanks.

duke_nukem
  • 647
  • 2
  • 9
  • 16

1 Answers1

0

I solved this simply by adding DATABASE_ENGINE = "postgresql" in my settings.py.

Looking at the code which uses this variable in site-packages/django_evolution-0.6.0-py2.7.egg/tests/utils.py (your path will probably be slightly different), utils.py will, depending on the database, call one of the files in django_evolution-0.6.0-py2.7.egg/django_evolution/db. Looking then at the postgresql.py file in the db directory, it appears to be a short script which runs a few basic tests against your database implementation. Since the postgis backend would not likely be significantly different from out-of-the-box postgres, I believe it is safe to use postgresql as your DATABASE_ENGINE value.

huzeyfe
  • 3,554
  • 6
  • 39
  • 49
scottmrogowski
  • 2,063
  • 4
  • 23
  • 32