gpt4 book ai didi

python - Heroku 'DATABASES' 未定义

转载 作者:太空宇宙 更新时间:2023-11-03 12:47:20 27 4
gpt4 key购买 nike

我正在尝试让 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() }

关于python - Heroku 'DATABASES' 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27985368/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com