未找到 Django Facebook Python 包所需的身份验证后端
Required auth backend for Django Facebook Python package wasn't found
我一直在学习本教程 https://blog.pythonanywhere.com/35/
使用 PythonAnywhere 的 Django 网络应用程序创建 Facebook Canvas 应用程序。
创建 Django 网络应用程序时,我被要求选择 Python
版本。我能够完成教程并且它似乎正在工作
对于 Python 2 没有任何问题,但是它不再受支持所以我
决定升级到 Python 3.4 并删除旧应用程序。我正在使用
django_facebook
并使用 pip3.4 install --user
安装
.local
由 PythonAnywhere 推荐的目录,并通过了
再次教程,但是当我检查 Facebook 应用程序时,canvas 没有
出现。这是我在 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 没有找到,但是
它在我的 settings.py:
中
"""
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 和网络编程
我真的很想找出导致此错误的原因以及是否有
修复它。
installation instructions 提到有必要添加 AUTH_USER_MODEL
设置,但我在您的 settings.py
中没有看到。您可能还漏掉了其他步骤,但我没有完全检查。
我一直在学习本教程 https://blog.pythonanywhere.com/35/
使用 PythonAnywhere 的 Django 网络应用程序创建 Facebook Canvas 应用程序。
创建 Django 网络应用程序时,我被要求选择 Python
版本。我能够完成教程并且它似乎正在工作
对于 Python 2 没有任何问题,但是它不再受支持所以我
决定升级到 Python 3.4 并删除旧应用程序。我正在使用
django_facebook
并使用 pip3.4 install --user
安装
.local
由 PythonAnywhere 推荐的目录,并通过了
再次教程,但是当我检查 Facebook 应用程序时,canvas 没有
出现。这是我在 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 没有找到,但是 它在我的 settings.py:
中"""
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 和网络编程 我真的很想找出导致此错误的原因以及是否有 修复它。
installation instructions 提到有必要添加 AUTH_USER_MODEL
设置,但我在您的 settings.py
中没有看到。您可能还漏掉了其他步骤,但我没有完全检查。