Django runserver permanent

DjangoShell

Django Problem Overview


How can I make the development server from django running permanent? So that it does't stop when I quit the shell.

Thanks

Django Solutions


Solution 1 - Django

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

Solution 2 - Django

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

Solution 3 - Django

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

Solution 4 - Django

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

>exit

Solution 5 - Django

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.

Solution 6 - 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

Solution 7 - Django

On Windows, run

pythonw.exe manage.py runserver

Solution 8 - Django

I'm just about to do this myself. The scenario is that I'm rapid prototyping for a client and they need to see what things look like. There will never be more than 2-3 people on this at a time, but I don't want to set up Apache or stay logged in.

sudo ./manage.py runserver 192.168.1.94:80 [run this on port 80 so a normal business user can see it]
ctrl+z [to suspend the job (same thing as appending & to the above command but then I don't need to deal with entering the sudo password on the command line)]
bg %1 [puts the job in the background]
jobs [just to see what's going on]
exit [exit the session]

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjakobwView Question on Stackoverflow
Solution 1 - DjangoTravisView Answer on Stackoverflow
Solution 2 - DjangoMikeNView Answer on Stackoverflow
Solution 3 - DjangokelorekView Answer on Stackoverflow
Solution 4 - DjangoRanvijay SachanView Answer on Stackoverflow
Solution 5 - DjangowoakasView Answer on Stackoverflow
Solution 6 - DjangoSushant PatilView Answer on Stackoverflow
Solution 7 - DjangoTomas AndrleView Answer on Stackoverflow
Solution 8 - DjangoAdam NelsonView Answer on Stackoverflow