Heroku 'DATABASES' 未定义

Heroku 'DATABASES' is not defined

我正在尝试让 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可能想使用)。

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

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