2

while installing django_facebook, i got an error :

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

It is a pure django project created by pycharm. I was following the document of django_facebook, installation section. What I do is just get facebook app and type the code 'django_facebook' in INSTALLED_APP in settings.py. It's same results when syncdb also.

I'm using python-2.7.5 and django-1.6.5. I can't find any answer to solve this. anybody knows this?

4

2 回答 2

5

关于警告No handlers could be found for logger "django_facebook.models" 而不是错误。这个问题是在搜索该警告时出现的,认为这对其他人有用。

django-facebook 在运行时输出日志,就像其他 django 组件一样。你必须告诉 Django 你想对这些消息做什么。在 django 术语中,应用程序将一些消息作为记录器输出,而无需知道如何处理它们,然后您必须将这些消息修补到对您的用例一无所知但确实知道发送电子邮件/文本/的处理程序信鸽。

在您的settings.py文件 findLOGGING=...中,您必须在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,
        }
    }
}
于 2014-11-08T12:34:00.493 回答
0

你可以试试pip install pillow

于 2014-06-26T11:33:42.053 回答