我試圖對在Heroku我GeoDjango內置的應用程序運行時heroku run python manage.py syncdb
「DatabaseOperations」對象有沒有屬性「geo_db_type」的錯誤,但我得到了以下錯誤:獲取做執行syncdb
AttributeError的:「DatabaseOperations」對象有沒有屬性「geo_db_type」
Allofmyresearch取得了相同的解決方案:確保使用django.contrib.gis.db.backends.postgis
作爲數據庫引擎。有趣的是,我已經在做這(我也有django.contrib.gis
在INSTALLED_APPS
):
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': '...',
'HOST': '...',
'PORT': ...,
'USER': '...',
'PASSWORD': '...'
}
}
INSTALLED_APPS = (
...,
'django.contrib.gis',
)
有別的我失蹤?任何幫助是極大的讚賞,下面是引用完整的錯誤跟蹤:
Running `python manage.py syncdb` attached to terminal... up, run.1
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/app/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/app/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/app/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
return self.handle_noargs(**options)
File "/app/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 91, in handle_noargs
sql, references = connection.creation.sql_create_model(model, self.style, seen_models)
File "/app/lib/python2.7/site-packages/django/db/backends/creation.py", line 44, in sql_create_model
col_type = f.db_type(connection=self.connection)
File "/app/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py", line 200, in db_type
return connection.ops.geo_db_type(self)
AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'
更新:我跟着GeoDjango tutorial和Heroku/Django tutorial,並建立了一個簡單的應用程序,我開發的機器上工作。我使用custom GeoDjango buildpack將它推送到Heroku,並嘗試了syncdb,但得到相同的錯誤。這是Django/GeoDjango,Heroku還是buildpack的問題?我的開發環境使用PostgreSQL 9.1和PostGIS 2.0,但Heroku使用9.0.9和1.5,這可能是問題嗎?
我仍然在使用自定義生成包後出現此錯誤。 – limovala
雖然問題是Heroku特定的,但標題相當一般。如果Django DATABASES ENGINE沒有設置爲django.contrib.gis.db.backends.postgis –