AlexW
AlexW

Reputation: 2587

Django with Unicorn and Nginx, creating gunicorn logs

I Launch my Django app in a docker container, using a startup script as per the below:-

#!/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 

Unicorn and ngnix every now and then give me a 502 error, so I went to look for logs and it looks by default gunicorn does not log any? im on version 19.7.1

so I added the to the exec guncicorn command:

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

Which I goy form the gunicorn documentation. however now Gunicorn fails to launch with the following error:-

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

How can I create the gunicorn logs to debug these errors?

Thanks

Upvotes: 0

Views: 597

Answers (1)

Jahongir Rahmonov
Jahongir Rahmonov

Reputation: 13753

Remove comma and you should be fine:

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

Upvotes: 1

Related Questions