Heroku不会寻找我为它设置的DJANGO_SETTINGS_MODULE

时间:2018-01-14 14:43:19

标签: django heroku

我正在部署我的第一个网站。我打算使用一个设置文件进行生产,一个用于开发。因此,我有这样的结构:

workout
|
|-\settings
    |
    |- production.py
    |- development.py

为了让heroku知道在哪里找到设置文件,我这样做:

$ heroku config:set DJANGO_SETTINGS_MODULE=workout.settings.production
Setting DJANGO_SETTINGS_MODULE and restarting ⬢ workoutcalendar... done, v3
DJANGO_SETTINGS_MODULE: workout.settings.production

再次推动。现在一切都很好,对吧?但不是:

remote: -----> $ python manage.py collectstatic --noinput
remote:        Traceback (most recent call last):
remote:          File "manage.py", line 22, in <module>
remote:            execute_from_command_line(sys.argv)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
remote:            utility.execute()
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 317, in execute
remote:            settings.INSTALLED_APPS
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
remote:            self._setup(name)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 43, in _setup
remote:            self._wrapped = Settings(settings_module)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 106, in __init__
remote:            mod = importlib.import_module(self.SETTINGS_MODULE)
remote:          File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
remote:            return _bootstrap._gcd_import(name[level:], package, level)
remote:          File "<frozen importlib._bootstrap>", line 994, in _gcd_import
remote:          File "<frozen importlib._bootstrap>", line 971, in _find_and_load
remote:          File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
remote:          File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
remote:          File "<frozen importlib._bootstrap>", line 994, in _gcd_import
remote:          File "<frozen importlib._bootstrap>", line 971, in _find_and_load
remote:          File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
remote:        ModuleNotFoundError: No module named 'workout.settings'
remote: 
remote:  !     Error while running '$ python manage.py collectstatic --noinput'.
remote:        See traceback above for details.
remote: 
remote:        You may need to update application code to resolve this error.
remote:        Or, you can disable collectstatic for this application:
remote: 
remote:           $ heroku config:set DISABLE_COLLECTSTATIC=1
remote: 
remote:        https://devcenter.heroku.com/articles/django-assets
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to workoutcalendar.
remote: 
To https://git.heroku.com/workoutcalendar.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/workoutcalendar.git'

似乎正在寻找workout.settings而不是workout.settings.production,对吧?为什么我为它设置环境变量的方式与我在私人计算机上完成的方式相同(在哪里可行)?

0 个答案:

没有答案