【问题标题】:daphne run in supervisor returns an error django.core.exceptions.ImproperlyConfigureddaphne 在主管中运行返回错误 django.core.exceptions.ImproperlyConfigured
【发布时间】:2021-11-24 21:41:59
【问题描述】:

为什么 daphne 通过主管向我返回错误

django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure () before accessing settings.

但是当我用 supervisorctl 运行它时,它可以工作。我定义了一个系统变量。在venv中运行会不会出错?

主管会议

[fcgi-program:asgi]
# TCP socket used by Nginx backend upstream
socket=tcp://localhost:8099

# Directory where your site's project files are located
directory=/srv/app/

# Each process needs to have a separate socket file, so we use process_num
# Make sure to update "mysite.asgi" to match your project name
command=/srv/venv/bin/daphne -u /srv/run/daphne/daphne%(process_num)d.sock --fd 0 --access-log - --proxy-headers mysite.asgi:application

# Number of processes to startup, roughly the number of CPUs you have
numprocs=1

# Give each process a unique name so they can be told apart
process_name=asgi%(process_num)d

# Automatically start and recover processes
autostart=true
autorestart=true

# Choose where you want your log to go
stdout_logfile=/srv/log/daphne.log
redirect_stderr=true

【问题讨论】:

    标签: django websocket daphne


    【解决方案1】:

    我在conf中添加了[fcgi-program:asgi]

    environment=DJANGO_SETTINGS_MODULE=mysite.settings
    

    问题解决了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-13
      • 2016-07-16
      • 2019-04-17
      • 2012-05-25
      • 1970-01-01
      • 2020-03-13
      • 2019-02-20
      • 2022-08-04
      相关资源
      最近更新 更多