关于EB与daphne和工人的Django

时间:2017-02-16 14:08:08

标签: django amazon-web-services supervisord

我正在尝试在弹性豆秆上部署一个带有频道的django应用程序并且避风港已经成功。我已配置主管以运行daphne和工作人员但是当我部署它时,daphne和工人的主管状态进入FATAL状态。我遵循了本教程:http://blog.mangoforbreakfast.com/2017/02/13/django-channels-on-aws-elastic-beanstalk-using-an-alb

这是我的 supervisord.conf

[unix_http_server]
file=/opt/python/run/supervisor.sock    ; (the path to the socket file)
;chmod=0700                 ; socket file mode (default 0700)
;chown=nobody:nogroup       ; socket file uid:gid owner

[supervisord]
logfile=/opt/python/log/supervisord.log ;   (main log file; default $CWD/supervisor.log)
logfile_maxbytes=10MB       ; (max min logfile bytes b4 rotation;default 50MB)
logfile_backups=10          ; (num of main logfile rotation backups;default 10)
loglevel=info               ; (log level;default info; others: debug,warn,trace)
pidfile=/opt/python/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
minfds=1024                 ; (min. avail startup file descriptors;default 1024)
minprocs=200                ; (min. avail process descriptors;default 200)
directory=/opt/python/current/app   ; (default is not to cd during start)
;nocleanup=true             ; (don't clean up tempfiles at start;default false)

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///opt/python/run/supervisor.sock

[program:httpd]
command=/opt/python/bin/httpdlaunch
numprocs=1
directory=/opt/python/current/app
autostart=true
autorestart=unexpected
startsec=1                      ; number of secs prog must stay running (def. 1)
startretries=3                  ; max # of serial start failures (default 3)
exitcodes=0,2                   ; 'expected' exit codes for process (default 0,2)
killasgroup=false               ; SIGKILL the UNIX process group (def false)
redirect_stderr=false

[program:Daphne]
environment=PATH="/opt/python/run/venv/bin"
command=/opt/python/run/venv/bin/daphne -b 0.0.0.0 -p 5000 <projectName>.asgi:channel_layer
directory=/opt/python/current/app
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/tmp/daphne.out.log

[program:Worker]
environment=PATH="/opt/python/run/venv/bin"
command=python manage.py runworker
directory=/opt/python/current/app
process_name=%(program_name)s_%(process_num)02d
numprocs=4
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/tmp/workers.out.log
daphne上的

错误

Traceback (most recent call last):
  File "/opt/python/run/venv/bin/daphne", line 11, in <module>
    sys.exit(CommandLineInterface.entrypoint())
  File "/opt/python/run/venv/local/lib/python3.4/site-packages/daphne/cli.py", line 105, in entrypoint
    cls().run(sys.argv[1:])
  File "/opt/python/run/venv/local/lib/python3.4/site-packages/daphne/cli.py", line 135, in run
    channel_layer = importlib.import_module(module_path)
  File "/opt/python/run/venv/lib64/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 "./hungryboat/asgi.py", line 10, in <module>
    channel_layer = get_channel_layer()
  File "/opt/python/run/venv/local/lib/python3.4/site-packages/channels/asgi.py", line 98, in get_channel_layer
    django.setup(set_prefix=False)
  File "/opt/python/run/venv/local/lib/python3.4/site-packages/django/__init__.py", line 22, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/opt/python/run/venv/local/lib/python3.4/site-packages/django/conf/__init__.py", line 53, in __getattr__
    self._setup(name)
  File "/opt/python/run/venv/local/lib/python3.4/site-packages/django/conf/__init__.py", line 41, in _setup
    self._wrapped = Settings(settings_module)
  File "/opt/python/run/venv/local/lib/python3.4/site-packages/django/conf/__init__.py", line 116, in __init__
    raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
工人

错误

Traceback (most recent call last):
  File "manage.py", line 18, in <module>
    "Couldn't import Django. Are you sure it's installed and "
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to acti$
  File "manage.py", line 18, in <module>
    "Couldn't import Django. Are you sure it's installed and "
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to acti$

如果有人能够确定问题是什么......请告诉我。

0 个答案:

没有答案