Django 1.5 Pyfacebook错误

时间:2013-06-28 10:02:12

标签: django django-1.5 pyfacebook

我想在django 1.5中使用Pyfacebook。我按照本教程http://agiliq.com/blog/2009/02/how-to-build-a-facebook-app-in-django/进行操作。

当我在'facebook.djangofb.FacebookMiddleware'(settings.py)中添加MIDDLEWARE_CLASSES时。 我有这样的消息:发生服务器错误。请联系管理员。

Traceback (most recent call last):
  File "c:\Python27\lib\wsgiref\handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "c:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", l
ine 72, in __call__
    return self.application(environ, start_response)
  File "c:\Python27\lib\site-packages\django\core\handlers\wsgi.py", line 236, i
n __call__
    self.load_middleware()
  File "c:\Python27\lib\site-packages\django\core\handlers\base.py", line 59, in
 load_middleware
    mw_instance = mw_class()
  File "build\bdist.win32\egg\facebook\djangofb\__init__.py", line 511, in __ini
t__
    self.secret_key = secret_key or settings.FACEBOOK_SECRET_KEY
  File "c:\Python27\lib\site-packages\django\conf\__init__.py", line 54, in __ge
tattr__
    return getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'FACEBOOK_SECRET_KEY'

我尝试在settings.py中添加FACEBOOK_SECRET_KEY,但我有同样的错误

由于

1 个答案:

答案 0 :(得分:0)

最后我添加

FACEBOOK_SECRET_KEY = 'xxxxxxxx'
FACEBOOK_API_KEY = 'xx'

在settings.py中,它可以正常工作。

谢谢你们