Issue
Here's are the commands i'm using to start my project:
nginx -s stop
workon my_project_env
pkill -f uwsgi -9
uwsgi -x /root/my_project/My_web_api/My_web_api.xml
deactivate
nginx
I want to make sure that this project starts even if the server reboots.
But writing a shell command file as xxx.sh
is not going to work,
as shell command won't simply work in virtualenv.
All of the command above will just work in the main terminal,
but some command must work on the virtualenv.
How can i work this out?
Solution
You will need to call the uwsgi command using the virtualenv's file for uwsgi. that way you won't need to activate the virtualenv.
Something like below,
/path/to/virtualenvs/project-name/bin/uwsgi -x /root/my_project/My_web_api/My_web_api.xml
All the commands that need to be run using virtualenv should be called this way, so that you won't need to activate the virtualenv.
Answered By - Akash Ranjan