【发布时间】:2013-08-02 22:15:53
【问题描述】:
我正在使用 https://devcenter.heroku.com/articles/django 教程在 Heroku 上设置一个 Django 应用程序,我在运行 heroku run python manage.py syncdb 时遇到了以下错误
ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
我在本地同步时遇到同样的错误。我已经阅读了 StackOverflow 上的所有线程,但没有解决这个问题。 settings.py的相关部分:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': '',
'PASSWORD': '',
'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
}
import dj_database_url
DATABASES['default'] = dj_database_url.config()
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Allow all host headers
ALLOWED_HOSTS = ['*']
# Static asset configuration
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
【问题讨论】:
-
错误很明显。您尚未指定后端数据库和正确的凭据。在
DATABASES设置中 -
@karthikr 我已经为 settings.py 尝试了不同的选项,但是,在教程中,它没有指定要填写它们,所以我不确定它们应该是什么!你能帮忙吗?
-
@karthikr 谢谢,我试过了,得到了同样的错误
标签: django postgresql heroku heroku-postgres