Запуск daphne в супервизоре возвращает ошибку django.core.exceptions.ImproperlyConfigured
Почему Дафна возвращает мне ошибку через супервизор
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?
supervisor conf
[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
проблема решена