how to make python manage.py runserver still running if terminal close?
17,874
Solution 1
You could try to run your Python script with the nohup
command infront. Nohup will make the script immume to hangups.
example
nohup python myscript.py &
Your output will be send to nohup.out.
Solution 2
Very nice alternative to screen
is program called tmux. I use it constantly for daily basis.
Tip:
To dump process into same terminal, runcd any command you'd like, then:
- Ctrl + Z - to stop process
- write
bg
- it will dump process to the background
Related videos on Youtube
Author by
Ivan
Updated on September 18, 2022Comments
-
Ivan over 1 year
python manage.py runserver 0.0.0.0:8000
how to make this command running if terminal closefor now i use screen and it works any other way to do that? i mean for production how to link it to ngix or apahce in ubuntu server?
-
web.learner about 9 yearsIf your question is not a duplicate please edit it to explain why. So far it still looks like a duplicate.
-
-
David about 9 yearsYou could also use forever. This is a nodejs script but you can run Python scripts with it. link
-
DarkCygnus over 5 yearsThis will make the process go to background, but it will not prevent it from being killed if you
exit
the session. To do that one has to use screen or similar, where, as you pointed out, you can use the nohup in addition to screen... -
suhailvs over 2 years
nohup python manage.py runserver &
this worked for me. to kill it you need to find the pid usingps aux | grep manage.py
then kill it usingkill pid