简体   繁体   English

找不到所需的Django Facebook Python软件包的身份验证后端

[英]Required auth backend for Django Facebook Python package wasn't found

I've been following this tutorial https://blog.pythonanywhere.com/35/ on creating a Facebook Canvas app using PythonAnywhere's Django web app. 我一直在遵循本教程https://blog.pythonanywhere.com/35/ ,以使用PythonAnywhere的Django网络应用创建Facebook Canvas应用。 When creating a Django web app, I was asked to choose the Python version. 在创建Django网络应用时,系统要求我选择Python版本。 I was able to finish the tutorial and it seems to be working for Python 2 without any problems, however it's no longer supported so I decided to upgrade to Python 3.4 and deleted the old app. 我能够完成本教程,并且似乎可以在Python 2上正常运行,但是不再受支持,因此我决定升级到Python 3.4并删除了旧应用。 I'm using the django_facebook and installed it with pip3.4 install --user on .local directory as recommended by PythonAnywhere and went thru the tutorial again, but when I check the Facebook app, the canvas doesn't appear. 我正在使用django_facebook ,并按照pip3.4 install --user建议在.local目录上使用pip3.4 install --user将其安装了该文件,并再次通过了本教程,但是当我检查Facebook应用程序时,画布没有出现。 This is what I find in the PythonAnywhere Error Log: 这是我在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

It says django_facebook.auth_backends.FacebookBackend wasn't found, but it's there in my settings.py: 它说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']

I've done a web search on this, but it seems like I'm the only who's having this issue. 我已经对此进行了网络搜索,但似乎只有我这个问题。 I'm early to Django and web programming in general and I really want to find out what's causing this error and if there's a fix to it. 我一般都对Django和Web编程很早,并且我真的很想找出导致此错误的原因以及是否有解决方法。

The installation instructions mention that it's necessary to add a AUTH_USER_MODEL setting and I don't see that in your settings.py . 安装说明提到有必要添加AUTH_USER_MODEL设置,但在settings.py中看不到该settings.py You may have missed other steps, but I haven't checked fully. 您可能错过了其他步骤,但我没有完全检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM