Django Persistent Server

How can I make the development server from django permanent? So he does not stop when I exit the shell.

thank

+50
django shell
Jul 27 '09 at 14:36
source share
8 answers

Another easy way to do this:

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

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

This creates a server on the screen and then separates it. So you can just go back and type:

 [user@host]$screen -r 

and you can take control of the server again and see what happens.

+63
Jul 27 '09 at 14:43
source share
β€” -

If you are using Linux / Unix, use the nohup command.

 nohup manage.py runserver & 

Then, to return it, use the fg command:

 fg 

Thanks: Xiong Chiamiov

+51
Jul 27 '09 at 14:37
source share

As Travis says, use the screen. If you have not installed it yet, you will receive it:

 sudo apt-get install screen screen 

Press Enter. Now it looks like you are in a different terminal window.

Start from the server:

 python manage.py runserver 0.0.0.0:8000 

Now you start the server, and you want to return to your first screen, allowing the django application to continue. The screen has a nice built-in feature. To return to the type of your main terminal:

 ctrl+ad 

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

 screen -r 

If you have multiple screens open, you can achieve the correct one with a 4-5 digit identification number:

 screen -r 1333 

And the manual pages are pretty good:

 man screen 
+25
Mar 22 '13 at 20:04 on
source share
 on Ubuntu run:>./manage.py runserver 0.0.0.0:8000 > /dev/null 2>&1 & >exit 
+9
Jun 02 '15 at 11:35
source share

create a file with this example / tmp / screendjango:

 screen python manage.py runserver 

and then you put:

 screen -dmS django -c /tmp/screendjango 

to attach sessiΓ³n you put

 screen -d -r django. 
+2
Jul 27 '09 at 15:23
source share

On Windows, run

 pythonw.exe manage.py runserver 
0
Jul 27 '09 at 18:10
source share

I am going to do it myself. The scenario is that I quickly create prototypes for the client, and they need to see how things look. At this time there will be no more than 2-3 people, but I do not want to configure Apache or remain on the system.

 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 going on] exit [exit the session] 
0
Aug 03 '09 at 16:49
source share

For windows you can use the following command

 python manage.py runserver 0.0.0.0:8000 

To use Ubuntu / Linux

 nohup python manage.py runserver 0.0.0.0:8000 & 

to return from the nohup command use the fg command

 fg 
0
Apr 03 '19 at 8:23
source share



All Articles