安装django_facebook时,我收到一个错误:
Validating models...
No handlers could be found for logger "django_facebook.models"
Unhandled exception in thread started by <function wrapper at 0x1032a5758>
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/django/utils/autoreload.py", line 93, in wrapper
fn(*args, **kwargs)
File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 101, in inner_run
self.validate(display_num_errors=True)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 310, in validate
num_errors = get_validation_errors(s, app)
File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 113, in get_validation_errors
from django.utils.image import Image
File "/Library/Python/2.7/site-packages/django/utils/image.py", line 154, in <module>
Image, _imaging, ImageFile = _detect_image_library()
File "/Library/Python/2.7/site-packages/django/utils/image.py", line 108, in _detect_image_library
_("Neither Pillow nor PIL could be imported: %s") % err
django.core.exceptions.ImproperlyConfigured: Neither Pillow nor PIL could be imported: No module named Image
Run Code Online (Sandbox Code Playgroud)
它是由pycharm创建的纯django项目.我正在关注django_facebook的文档,安装部分.我所做的只是获取facebook应用程序并在settings.py中的INSTALLED_APP中键入代码'django_facebook'.syncdb也是一样的结果.
我正在使用python-2.7.5和django-1.6.5.我找不到任何答案来解决这个问题.谁知道这个?
关于警告No handlers could be found for logger "django_facebook.models" 而不是错误.这个问题出现在寻找警告上,认为这对其他人有用.
django-facebook在运行时输出日志,就像其他django组件一样.你必须告诉Django你想用这些消息做什么.在django术语中,应用程序输出一些消息作为记录器而不需要知道如何处理它们,然后你必须将这些消息修补到一个对你的用例一无所知的处理程序,但是确实知道发送电子邮件/文本/载体鸽.
在你的settings.py文件中LOGGING=...,在loggersdict中你必须指定你想要处理django-facebook输出的处理程序.
有关更多信息,请参阅有关记录的文档https://djangoproject.com/en/dev/topics/logging/
我的日志变量看起来像这样,请注意底部的位:
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','console'],
'level': 'ERROR',
'propagate': True,
},
'django_facebook.models': {
'handlers': ['mail_admins','console'],
'level': 'ERROR',
'propagate': True,
}
}
}
Run Code Online (Sandbox Code Playgroud)