与Unicorn和Nginx的Django,创建gunicorn日志

时间:2017-10-06 12:14:11

标签: python django nginx gunicorn

我使用启动脚本在Docker容器中启动我的Django应用程序,如下所示: -

#!/bin/bash
python manage.py collectstatic --noinput
python manage.py makemigrations 
python manage.py migrate 
/etc/init.d/celeryd start
/etc/init.d/celerybeat start
exec gunicorn itapp.wsgi -b 0.0.0.0:8000 

独角兽和ngnix时不时给我一个502错误,所以我去寻找日志,它看起来默认gunicorn不记录任何?即时通讯版本19.7.1

所以我添加了exec guncicorn命令:

exec gunicorn itapp.wsgi -b 0.0.0.0:8000  --error-logfile /var/log/gunicorn/errors.log , --log-file /var/log/gunicorn/access.log 

我的goyorn形成了gunicorn文档。但是现在Gunicorn无法启动,出现以下错误: -

usage: gunicorn [OPTIONS] [APP_MODULE]
gunicorn: error: unrecognized arguments: ,

如何创建gunicorn日志来调试这些错误?

由于

1 个答案:

答案 0 :(得分:1)

删除逗号,你应该没问题:

exec gunicorn itapp.wsgi -b 0.0.0.0:8000  --error-logfile /var/log/gunicorn/errors.log --log-file /var/log/gunicorn/access.log