Django找不到用于记录程序“城市”的处理程序。 [英] Django No handlers could be found for logger "cities"
问题描述
我正在尝试通过设置Django-Cities https://github.com/coderholic/django-c 使用以下命令:
I'm trying to setup Django-Cities https://github.com/coderholic/django-cities by using the following command:
sudo python manage.py cities --force --import=all
大约10分钟后,终端打印:
After around 10 mins the terminal prints:
No handlers could be found for logger "cities"
然后什么也没有发生,我等待小时。我检查了数据库,没有任何数据添加到由syncdb生成的数据库中。
Then nothing happens, I wait for hours. I checked the database and no data had been added to the database generated by syncdb.
我的某些设置...。设置
Some of my settings.... Settings
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
TIME_ZONE = 'Europe/London'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-GB'
# List of plugins to process data during import
CITIES_PLUGINS = [
'cities.plugin.postal_code_ca。插件,#加拿大邮政编码需要重新映射区域代码以匹配地理名称
]
CITIES_PLUGINS = [ 'cities.plugin.postal_code_ca.Plugin', # Canada postal codes need region codes remapped to match geonames ]
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.flatpages',
'django.contrib.admin',
'django.contrib.gis',
'accounts',
'userena',
'guardian',
'easy_thumbnails',
'events',
'cities',
)
# Django-guardian settings
ANONYMOUS_USER_ID = -1
AUTH_PROFILE_MODULE = 'accounts.Profile'
# GEOS Library
GEOS_LIBRARY_PATH='/opt/local/lib/libgeos_c.dylib'
CITIES_POSTAL_CODES = ['GB']
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
推荐答案
这应该输出t o屏幕。
This should output to screen.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'console':{
'level': 'DEBUG',
'class': 'logging.StreamHandler'
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
'cities': {
'handlers': ['console'],
'level': 'INFO'
},
}
}
这篇关于Django找不到用于记录程序“城市”的处理程序。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!