Im deploying a wsgi+asgi django project, it’s working when config wsgi application using gunicorn,
but there has some wrong when i deploying daphne,
first i write a file /etc/systemd/system/daphne.service
[Unit]
Description=WebSocket Daphne Service
After=network.target
[Service]
User=admin
Group=www-data
WorkingDirectory=/var/www/backend
# EnvironmentFile=/var/www/backend/main/.env
ExecStart=/var/www/backend/venv/bin/python /var/www/backend/venv/bin/daphne -b 0.0.0.0 -p 8001 main.asgi:application
[Install]
WantedBy=multi-user.target
When i start daphne.service, i got error:
Jun 20 06:58:34 linux systemd[1]: Stopping WebSocket Daphne Service...
Jun 20 06:58:35 linux systemd[1]: daphne.service: Succeeded.
Jun 20 06:58:35 linux systemd[1]: Stopped WebSocket Daphne Service.
Jun 20 06:58:35 linux systemd[1]: Started WebSocket Daphne Service.
Jun 20 06:58:37 linux python[41634]: 2024-06-20 06:58:37,300 INFO /var/www/backend/.env not found - if you're not configuring your environment separately, check this.
But why gunicorn is normal working and daphne is wrong.
My project’s .env file path is /backend/main/.env
,
How should i do?