diff --git a/compose/django/gunicorn.sh b/compose/django/gunicorn.sh index 1557f8b..809111f 100644 --- a/compose/django/gunicorn.sh +++ b/compose/django/gunicorn.sh @@ -1,4 +1,7 @@ #!/bin/sh python /app/manage.py collectstatic --noinput python /app/manage.py compilescss +mkdir /var/log/gunicorn/ +chown -R root:django /var/log/gunicorn/ +chmod -R 770 /var/log/gunicorn/ /usr/local/bin/gunicorn config.wsgi -w 4 -b unix:/data/sockets/gunicorn.sock --error-logfile /var/log/gunicorn/gunicorn-error.log --chdir=/app diff --git a/config/settings/stage.py b/config/settings/stage.py index 73feb9d..5d99ab0 100644 --- a/config/settings/stage.py +++ b/config/settings/stage.py @@ -195,6 +195,11 @@ LOGGING = { 'class': 'logging.StreamHandler', 'formatter': 'verbose', }, + 'logfile': { + 'level':'DEBUG', + 'class':'logging.FileHandler', + 'filename': BASE_DIR + "/../logfile", + }, }, 'loggers': { 'django.request': { @@ -204,7 +209,7 @@ LOGGING = { }, 'django.security.DisallowedHost': { 'level': 'ERROR', - 'handlers': ['console', 'mail_admins'], + 'handlers': ['logfile', 'console', 'mail_admins'], 'propagate': True } }