Im using supervisor to run the django websocket in system startup .
When I start the supervisor it will raise
ModuleNotFoundError: No module named 'django'
in the log file .
Here is supervisor conf:
[fcgi-program:myProject]
environment=HOME="/home/ubuntu/envFiles/myProject/bin"
# TCP socket used by Nginx backend upstream
socket=tcp://0.0.0.0:8000
directory=/home/ubuntu/projects/myProject
command=daphne -u /run/daphne/daphne%(process_num)d.sock --fd 0 --access-log - --proxy-headers myProject.asgi:application
# Number of processes to startup, roughly the number of CPUs you have
numprocs=4
process_name=asgi%(process_num)d
autostart=true
autorestart=true
stdout_logfile=/home/ubuntu/logs/project.log
redirect_stderr=true
when i try to restart the supervisor by supervisorctl restart all
, it has import module error again.
Error log :
ModuleNotFoundError: No module named 'django'
I think it uses system python path But i defined environment
in config file so supervisor must use there environment .
whats the problem ?
How can i set my django environment files in supervisor conf ?
Just try to install package into another python directory, i had same problem with supervisor and it was solved after this: