How to run Django project in background

Question:

Recent I am running Django project on terminal using this command:

python manage.py runserver 0.0.0.0:80

But Server is stopped by closing terminal, So I need to run server in background.
How can I solve this issue?

Asked By: Victor

||

Answers:

You can use the nohup command, so your command runs without the terminal and all the outputs from the program will go to the file nohup.out (in the same directory you ran the command).

Use like so:

nohup python manage.py runserver 0.0.0.0:80
Answered By: zeehyt

You can use screen to run a program in background.

This should answer your question

Answered By: PleSo

You may try:

python manage.py runserver 0.0.0.0:80 &

"&" puts the executed command in background and sets init as it’s parent process when you close the terminal

Answered By: obayhan

You can run nohup, an output of the command will not be set what will not be created in the command (where or was executed)

nohup python manage.py runserver 0.0.0.0:8000

If you are using some automation software, in order not to crash the deployment, add an ‘&’ at the end of the command, like this

nohup python manage.py runserver 0.0.0.0:8000 &
Answered By: Marcos Vile
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.