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?
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
You can use screen to run a program in background.
This should answer your question
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
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 &
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?
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
You can use screen to run a program in background.
This should answer your question
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
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 &