tags:

views:

1117

answers:

5

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

Thanks

+4  A: 

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

MikeN
Then to get it back, use the fg command.
Xiong Chiamiov
This won't allow you to exit the shell as a job will be running. Right?
Adam Nelson
@Adam N. You will be able to exit the shell, the nohup is for "no hangup", it will keep running the job after you leave the shell.
MikeN
+6  A: 

another easy way to do this is to run:

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

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.

Can one logout and get back to the screen though?
Adam Nelson
A: 

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.
woakas
I think that's the most complicated way to use screen, ever.
Xiong Chiamiov
A: 

On Windows, run

pythonw.exe manage.py runserver
TomA
A: 

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]
Adam Nelson