Django 服务器经常被杀死

Django server killed frequently

我正在开发 Django 项目并在专用服务器上对其进行测试。 该项目 运行 于:


运行

python manage.py runserver 192.168.30.17:8080 &

一切顺利。项目 运行 和 ps aux 我得到,例如:

root      8437  0.0  0.9 461108 39036 pts/0    S    15:17   0:00 python manage.py runserver 192.168.30.17:8080
root      8861  3.5  1.5 1319364 64232 pts/0   Sl   15:24   0:14 /new_esmart/esmart_env/bin/python manage.py runserver 192.168.30.17:8080

问题:服务器经常宕机,shell 上没有显示任何错误。我只是收到: Killed

如何检索更多信息以找出此次杀人的原因?

注意:目前没有 gunicorn et similia 解决方案。接下来的几个小时我必须使用 django 服务器

临时解决方案

杀死后重生服务器的脚本

until python manage.py runserver 192.168.30.17:8080; do
   echo "Server Django crashed with exit code $. Respawning ...">&2
   sleep 2
done

来自 django 开发服务器上的文档 https://docs.djangoproject.com/en/1.10/ref/django-admin/

DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests. (And that’s how it’s gonna stay. We’re in the business of making Web frameworks, not Web servers, so improving this server to be able to handle a production environment is outside the scope of Django.)

当然,它经常被杀死,它不是为 运行 长时间保存而设计的。设置标准解决方案之一,例如 gunicorn+nginx 或 apache+uswgi 等