heroku Roku配置:设置DISABLE_COLLECTSTATIC=1 Django

ffscu2ro  于 2022-11-13  发布在  Go
关注(0)|答案(1)|浏览(105)
$ python manage.py collectstatic --noinput
       Traceback (most recent call last):
         File "/tmp/build_01f62511/manage.py", line 22, in <module>
           main()
         File "/tmp/build_01f62511/manage.py", line 18, in main
           execute_from_command_line(sys.argv)
         File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
           utility.execute()
         File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 386, in execute
           settings.INSTALLED_APPS
         File "/app/.heroku/python/lib/python3.10/site-packages/django/conf/__init__.py", line 92, in __getattr__
           self._setup(name)
         File "/app/.heroku/python/lib/python3.10/site-packages/django/conf/__init__.py", line 79, in _setup
           self._wrapped = Settings(settings_module)
         File "/app/.heroku/python/lib/python3.10/site-packages/django/conf/__init__.py", line 190, in __init__
           mod = importlib.import_module(self.SETTINGS_MODULE)
         File "/app/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
           return _bootstrap._gcd_import(name[level:], package, level)
         File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
         File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
         File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
         File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
         File "<frozen importlib._bootstrap_external>", line 883, in exec_module
         File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
         File "/tmp/build_01f62511/main/settings.py", line 25, in <module>
           SECRET_KEY = config("SECRET_KEY")
         File "/app/.heroku/python/lib/python3.10/site-packages/decouple.py", line 243, in __call__
           return self.config(*args, **kwargs)
         File "/app/.heroku/python/lib/python3.10/site-packages/decouple.py", line 105, in __call__
           return self.get(*args, **kwargs)
         File "/app/.heroku/python/lib/python3.10/site-packages/decouple.py", line 90, in get
           raise UndefinedValueError('{} not found. Declare it as envvar or define a default value.'.format(option))
       decouple.UndefinedValueError: SECRET_KEY not found. Declare it as envvar or define a default value.
 !     Error while running '$ python manage.py collectstatic --noinput'.
       See traceback above for details.
       You may need to update application code to resolve this error.
       Or, you can disable collectstatic for this application:
          $ heroku config:set DISABLE_COLLECTSTATIC=1
       https://devcenter.heroku.com/articles/django-assets
 !     Push rejected, failed to compile Python app.
 !     Push failed

如何解决问题?

d6kp6zgx

d6kp6zgx1#

在终端中项目的根目录下运行此命令
配置:设置SECRET_KEY=SAFSAFSDAFSDF0ASDFSD

相关问题