Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django runserver permanent

Tags:

shell

django

People also ask

How do I keep Django server running?

Start your server there. Then press Ctrl-a, then d. This detach the screen session, keeping it running in the background.

What does Runserver do in Django?

The runserver command is a built-in subcommand of Django's manage.py file that will start up a development server for this specific Django project.


another easy way to do this is to run:

[user@host]$screen
[user@host]$python manage.py runserver 0.0.0.0:8000

Now press Ctrl+A and then press d to exit from this screen.

This creates the server in a screen and then detaches it. This way you can simply go back in and type:

[user@host]$screen -r

and you can take control of the server again and see whats going on.

You can also detach from the screen immediately:

screen -d -m python manage.py runserver 0.0.0.0:8000

If you are on Linux/Unix use the "nohup" command.

nohup manage.py runserver &

Then to get it back, use the fg command:

fg

Thanks to: Xiong Chiamiov


Like Travis says-- use screen. If you don't already have it installed, go get it:

sudo apt-get install screen
screen

Hit enter. Now it's like you're in a different terminal window.

Start you server with:

python manage.py runserver 0.0.0.0:8000

Now you're running the server, and you'd like to get back to your first screen while letting the django app continue running. Screen has a nice feature built-in for that. To get back to your main terminal type:

ctrl+a d

From there, you can get back to the django screen by typing:

screen -r

If you have multiple screens open you can reach the correct one by it's 4-5 digit ID number:

screen -r 1333

And the man pages are pretty good:

man screen

on Ubuntu run:>./manage.py runserver 0.0.0.0:8000 > /dev/null 2>&1 &

>exit

create a file with this, example /tmp/screendjango:

screen python manage.py runserver

and then you put:

screen -dmS django -c /tmp/screendjango

for attach the sessión you put

screen -d -r django.

For windows you can use following command

python manage.py runserver 0.0.0.0:8000

For ubuntu/linux use

nohup python manage.py runserver 0.0.0.0:8000 &

for go back from nohup command use fg command

fg