我用Django+Python+Gunicorn+Nginx+MySQL堆栈制作一个社交约会网站-http://www.tomonotomo.com
我的设置.pyDjango文件如下:DEBUG = False
TEMPLATE_DEBUG = False
ADMINS = (
('Pratik Poddar', 'xxxxxxxxxxx'),
)
MANAGERS = ADMINS
FAILED_RUNS_CRONJOB_EMAIL_PREFIX = "[Django - Tomonotomo - Cron Job] "
EMAIL_SUBJECT_PREFIX = "[Django - Tomonotomo] "
.....
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
}
},
'handlers': {
'null': {
'level': 'INFO',
'class': 'logging.NullHandler'
},
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django': {
'handlers': ['null'],
'level': 'INFO',
'propagate': True,
},
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
我的gunicorn配置(编辑:supervisor config)如下:
^{pr2}$
我的nginx配置有:access_log /home/ubuntu/tomonotomo-access.log;
error_log /home/ubuntu/tomonotomo-error.log error;
我看不到我的错误日志。我不想让debug=True,因为它在生产中是这样的。我也没有收到任何邮件。在
我希望得到有所有的日志在一个文件,并有所有的错误,每天上午电子邮件我。我如何实现这一点?在
多谢了