1.启动Django
数据库采用postgres,驱动psycopg2
gunicorn --certfile=XXXX --keyfile=XXXX --max-request 50 --max-requests-jitter 50 application.wsgi -c gunicorn_conf.py
2.异常信息
server closed the connection unexpectedly。
详细信息:
This probably means the server terminated abnormally before or while processing the request. Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py",line 8 return self.cursor.execute(sql,params) psycopg2.OperationalError:server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.
3.可能触发原因
设置max-request为某个数值,gunicorn将重新启动子worker,导致使用django 的model 读取数据库时就会报错。
4.解决方案
在使用
|