Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
296 views
in Technique[技术] by (71.8m points)

python - Django server killed frequently

I'm developing a Django project and testing it on a dedicated server. The project is running on:

  • django 1.9.6
  • virtualenv
  • python 2.7
  • cx_Oracle 5.2.1

Running

python manage.py runserver 192.168.30.17:8080 &

all goes well. Project running and with ps aux I get, for example:

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

THE PROBLEM: Frequently server goes down with no error showed on shell. I simply receive: Killed

How can I retrieve more information to find the cause of this killing?

NOTE: No gunicorn et similia solution right now. I have to use django server for the next hours

Temporary solution

A script that respawns the server when killed

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

From the documentation on the django development server 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.)

Of course it get's killed frequently, it's not designed to be kept running for long hours. Set up one of the standard solutions such as gunicorn+nginx or apache+uswgi etc.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...