Django没有为记录器“城市”找到处理程序

前端之家收集整理的这篇文章主要介绍了Django没有为记录器“城市”找到处理程序前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用以下命令设置Django-Cities https://github.com/coderholic/django-cities
sudo python manage.py cities --force --import=all

大约10分钟后终端打印:

No handlers could be found for logger "cities"

然后什么都没发生,我等了几个小时.我检查了数据库,没有数据添加到syncdb生成数据库中.

我的一些设置….设置

# 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.Plugin’,#加拿大邮政编码需要重新映射区域代码以匹配地理名称
]

INSTALLED_APPS = (
    'django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.sites','django.contrib.messages','django.contrib.staticfiles','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,},}
    }

解决方法

这应该输出到屏幕.
LOGGING = {
        'version': 1,'class': 'django.utils.log.AdminEmailHandler'
            },'console':{
                'level': 'DEBUG','class': 'logging.StreamHandler'
            },'cities': {
                'handlers': ['console'],'level': 'INFO'
            },}
    }
原文链接:https://www.f2er.com/python/185557.html

猜你在找的Python相关文章