记录器';django#u请求';无法配置
在得到一个记录器';django#u请求';无法配置,django,heroku,Django,Heroku,在得到一个collectstatic错误后,我运行了命令heroku run python./manage.py collectstatic--noinput,得到了以下回溯: Traceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/app/.heroku/python/lib/python2.7
collectstatic错误
后,我运行了命令heroku run python./manage.py collectstatic--noinput
,得到了以下回溯:
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 20, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/log.py", line 87, in configure_logging
logging_config_func(logging_settings)
File "/app/.heroku/python/lib/python2.7/logging/config.py", line 794, in dictConfig
dictConfigClass(config).configure()
File "/app/.heroku/python/lib/python2.7/logging/config.py", line 627, in configure
'%r: %s' % (name, e))
ValueError: Unable to configure logger 'django_request': Unable to add handler 'request_handler': 'request_handler'
我的Procfile
:
web: gunicorn django_test.wsgi
以及settings.py
的LOGGING
部分:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins':{
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
'filters': ['require_debug_false'],
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propogate': True,
},
}
}
在
Procfile
中,我尝试用.app
替换.wsgi
,但我只生成了一个ImportError
,我在线研究了我的错误,但我仍然不知道为什么会得到ValueError
或如何修复它。另外,我想知道我是否需要一个Apache服务器来让我的Django站点能够工作,或者Gunicorn就足够了?如果你能给我任何帮助,我将不胜感激。谢谢。我不知道这是否解释了“无法添加处理程序”错误消息,但您拼写的propagate
不正确。我以前也犯过同样的拼写错误,至少花了一个小时才发现问题。这并不能解释这条信息,但感谢您的拼写更正。
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins':{
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
'filters': ['require_debug_false'],
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propogate': True,
},
}
}