如何使用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(从屏幕上退出)?谢谢。
而不是runserver,使用gunicorn和 kill -HUP
重新加载服务器。