coderholic / django-cities

Countries and cities of the world for Django projects
MIT License
927 stars 371 forks source link

AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type' with Django 1.7 #68

Closed cristiangrojas closed 10 years ago

cristiangrojas commented 10 years ago

I'm trying to use django-cities with the new version of Django (1.7) and when I try to run the python manage.py syncdb command to create django-cities tables I got the following error (full traceback):

Operations to perform:
  Synchronize unmigrated apps: cities
  Apply all migrations: admin, contenttypes, auth, sessions
Synchronizing apps without migrations:
  Creating tables...
    Creating table cities_country_neighbours
    Creating table cities_country_alt_names
    Creating table cities_country
    Creating table cities_region_alt_names
    Creating table cities_region
    Creating table cities_subregion_alt_names
    Creating table cities_subregion
    Creating table cities_city_alt_names
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/cristianrojas/.virtualenvs/bbintlcargo/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/Users/cristianrojas/.virtualenvs/bbintlcargo/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/cristianrojas/.virtualenvs/bbintlcargo/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/cristianrojas/.virtualenvs/bbintlcargo/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/Users/cristianrojas/.virtualenvs/bbintlcargo/lib/python2.7/site-packages/django/core/management/base.py", line 533, in handle
    return self.handle_noargs(**options)
  File "/Users/cristianrojas/.virtualenvs/bbintlcargo/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 27, in handle_noargs
    call_command("migrate", **options)
  File "/Users/cristianrojas/.virtualenvs/bbintlcargo/lib/python2.7/site-packages/django/core/management/__init__.py", line 115, in call_command
    return klass.execute(*args, **defaults)
  File "/Users/cristianrojas/.virtualenvs/bbintlcargo/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/Users/cristianrojas/.virtualenvs/bbintlcargo/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 128, in handle
    created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)
  File "/Users/cristianrojas/.virtualenvs/bbintlcargo/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 228, in sync_apps
    sql, references = connection.creation.sql_create_model(model, no_style(), seen_models)
  File "/Users/cristianrojas/.virtualenvs/bbintlcargo/lib/python2.7/site-packages/django/db/backends/creation.py", line 82, in sql_create_model
    col_type = f.db_type(connection=self.connection)
  File "/Users/cristianrojas/.virtualenvs/bbintlcargo/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py", line 220, in db_type
    return connection.ops.geo_db_type(self)
AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'
coderholic commented 10 years ago

What DB are you using? Did you setup the GeoDjango extensions for your DB?

cristiangrojas commented 10 years ago

Uh! @coderholic I'm sorry, I was doing wrong and I didn't create the DB with postgis template. Thanks for your awesome support!