Web 应用程序 - 找不到 Django Facebook Python 包所需的身份验证后端



我一直在学习本教程https://blog.pythonanywhere.com/35/在…上使用PythonAnywhere的Django web应用程序创建一个FacebookCanvas应用程序。在创建Django web应用程序时,我被要求选择Python版本我完成了教程,它似乎起作用了对于Python 2没有任何问题,但是它不再受支持,所以我决定升级到Python 3.4并删除旧的应用程序。我正在使用django_facebook并将其与pip3.4 install --user一起安装PythonAnywhere推荐的.local目录,并通过再次使用教程,但当我检查Facebook应用程序时,画布没有显得这是我在PythonAnywhere错误日志中发现的:

2015-06-26 18:41:30,191 :Required auth backend django_facebook.auth_backends.FacebookBackend wasnt found
2015-06-26 18:43:20,474 :/home/username/.local/lib/python3.4/site-packages/django_facebook/models.py:66: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
2015-06-26 18:43:20,474 :  logger.warn('Required auth backend %s wasnt found', required)
2015-06-26 18:43:20,474 :
2015-06-26 18:43:20,473 :/home/username/.local/lib/python3.4/site-packages/django_facebook/models.py:66: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  logger.warn('Required auth backend %s wasnt found', required)
2015-06-26 18:43:20,474 :Required auth backend django_facebook.auth_backends.FacebookBackend wasnt found

上面说找不到django_facebook.auth_backends.FacebookBackend,但是就在我的房间里

"""
Django settings for mysite project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'                  
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = False
AUTH_PROFILE_MODULE = 'django_facebook.FacebookProfile'
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            os.path.join(os.path.dirname(__file__), 'templates').replace('\','/'),
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                # Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
                # list if you haven't customized them:
                'django.contrib.auth.context_processors.auth',
                'django.template.context_processors.debug',
                'django.template.context_processors.i18n',
                'django.template.context_processors.media',
                'django.template.context_processors.static',
                'django.template.context_processors.tz',
                'django.core.context_processors.request',
                'django.contrib.messages.context_processors.messages',
                'django_facebook.context_processors.facebook',
            ],
        },
    },
]
TEMPLATE_CONTEXT_PROCESSORS = (
    'django.core.context_processors.request',
    'django_facebook.context_processors.facebook',
)
AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'django_facebook.auth_backends.FacebookBackend',
)
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django_facebook',
    'jftapp',
)
MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    # 'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django_facebook.middleware.FacebookCanvasMiddleWare',
)
ROOT_URLCONF = 'mysite.urls'
WSGI_APPLICATION = 'mysite.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_URL = '/static/'
FACEBOOK_APP_ID = 'xxxxxxxxxxxxxxx'                       
FACEBOOK_APP_SECRET = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'                           
FACEBOOK_CANVAS_PAGE = 'https://apps.facebook.com/%s/' % FACEBOOK_APP_ID
FACEBOOK_SCOPE = ['publish_actions']

我已经对此进行了网络搜索,但似乎只有我有这个问题。我对Django和web编程很早我真的很想知道是什么导致了这个错误,如果修复它。

安装说明提到有必要添加AUTH_USER_MODEL设置,而我在您的settings.py中没有看到这一点。你可能错过了其他步骤,但我还没有完全检查。

最新更新