Heroku'DATABASES'没有定义

时间:2015-01-16 13:46:55

标签: python django heroku

我正在尝试使用django应用程序在Heroku上工作。

我一直收到这个错误:

Running `./manage.py migrate` attached to terminal... up, run.5743
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/__init__.py", line 345, in execute
    settings.INSTALLED_APPS
  File "/app/.heroku/python/lib/python3.4/site-packages/django/conf/__init__.py", line 46, in __getattr__
    self._setup(name)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/conf/__init__.py", line 42, in _setup
    self._wrapped = Settings(settings_module)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/conf/__init__.py", line 94, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/app/.heroku/python/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/app/wagtaildemo/settings/__init__.py", line 1, in <module>
    from .dev import *
  File "/app/wagtaildemo/settings/dev.py", line 1, in <module>
    from .base import *
  File "/app/wagtaildemo/settings/base.py", line 21, in <module>
    DATABASES['default'] =  dj_database_url.config()
NameError: name 'DATABASES' is not defined

以下是settings/base.py中的设置。在制作中,我将DJANGO_SETTINGS_MODULE设置为settings/dev.py,但没有任何数据库配置(安全问题在这里并不重要。我只是部署,所以其他人可以看看他们可能想要使用的CMS。)

1 个答案:

答案 0 :(得分:9)

DATABASES未定义,因此请尝试相反设置,而不是更新它。将该行更改为:

DATABASES = { 'default': dj_database_url.config() }