Django runserver permanent

后端 未结 8 481
-上瘾入骨i
-上瘾入骨i 2020-12-07 09:54

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

Thanks

8条回答
  •  眼角桃花
    2020-12-07 10:21

    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
    

提交回复
热议问题