daphne run in supervisor返回一个错误django.core.exceptions.Imprope



为什么daphne通过supervisor向我返回一个错误

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.

但是当我运行完superorctl后,它工作了。我定义了一个系统变量。在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

我添加到conf [fcgi-program:asgi]

environment=DJANGO_SETTINGS_MODULE=mysite.settings

问题解决了

相关内容

最新更新