@Kwad

Почему не видит SECRET_KEY при запуске через gunicorn?

При запуске через runserver - все отлично.
Запускаю через: gunicorn djecommerce.wsgi:application - выдает это:
(cloudenv) root@makf1n:~/cloudproject# gunicorn djecommerce.wsgi:application
[2020-03-19 17:19:02 +0000] [24419] [INFO] Starting gunicorn 20.0.4
[2020-03-19 17:19:02 +0000] [24419] [INFO] Listening at: http://127.0.0.1:8000 (24419)
[2020-03-19 17:19:02 +0000] [24419] [INFO] Using worker: sync
[2020-03-19 17:19:02 +0000] [24422] [INFO] Booting worker with pid: 24422
[2020-03-19 17:19:02 +0000] [24422] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/root/cloudproject/cloudenv/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/root/cloudproject/cloudenv/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
    self.load_wsgi()
  File "/root/cloudproject/cloudenv/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/root/cloudproject/cloudenv/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/root/cloudproject/cloudenv/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
    return self.load_wsgiapp()
  File "/root/cloudproject/cloudenv/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/root/cloudproject/cloudenv/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
    mod = importlib.import_module(module)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/root/cloudproject/djecommerce/wsgi.py", line 7, in <module>
    application = get_wsgi_application()
  File "/root/cloudproject/cloudenv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/root/cloudproject/cloudenv/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/root/cloudproject/cloudenv/lib/python3.6/site-packages/django/conf/__init__.py", line 79, in __getattr__
    self._setup(name)
  File "/root/cloudproject/cloudenv/lib/python3.6/site-packages/django/conf/__init__.py", line 66, in _setup
    self._wrapped = Settings(settings_module)
  File "/root/cloudproject/cloudenv/lib/python3.6/site-packages/django/conf/__init__.py", line 176, in __init__
    raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
[2020-03-19 17:19:02 +0000] [24422] [INFO] Worker exiting (pid: 24422)
[2020-03-19 17:19:02 +0000] [24419] [INFO] Shutting down: Master
[2020-03-19 17:19:02 +0000] [24419] [INFO] Reason: Worker failed to boot.


SECRET KEY находится в корне проект, в .env файле
  • Вопрос задан
  • 61 просмотр
Пригласить эксперта
Ответы на вопрос 2
dimonchik2013
@dimonchik2013
армяне в ночных клубах теперь не "итальянцы"
проверяй путь и права

права особенно - типа рут ты вручную , гуникорн от вебсервера обычно
Ответ написан
@Kwad Автор вопроса
Вот так ручками 5e73b43320d1d476439077.png
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы