用于在屏幕

时间:2017-02-19 00:42:51

标签: django bash shell gnu-screen

如何使用shell脚本重启django runserver?我在屏幕内运行了django服务器。

这是我的shell脚本restartpython.sh:

killall -9 python
screen -r
sleep 5
exec python manage.py runserver 0.0.0.0:8000
ctrl+a d          # how to make this into shell script??

当我执行此脚本时,我进入屏幕并且python服务器被杀死。但剧本没有这行:

exec python manage.py runserver 0.0.0.0:8000

显示此错误:

python: can't open file 'manage.py': [Errno 2] No such file or directory

另外,如何在shell脚本中运行ctrl + a d(从屏幕退出)?谢谢。

1 个答案:

答案 0 :(得分:0)

使用gunicornkill -HUP代替runserver,重新加载服务器。