主管 returns 中的达芙妮 运行 出错 django.core.exceptions.ImproperlyConfigured
daphne run in supervisor returns an error django.core.exceptions.ImproperlyConfigured
为什么达芙妮 returns 主管给我一个错误
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
我添加到 conf [fcgi-program:asgi]
environment=DJANGO_SETTINGS_MODULE=mysite.settings
问题已解决
为什么达芙妮 returns 主管给我一个错误
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
我添加到 conf [fcgi-program:asgi]
environment=DJANGO_SETTINGS_MODULE=mysite.settings
问题已解决