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

151 views Asked by At

I've been following this tutorial https://blog.pythonanywhere.com/35/ on creating a Facebook Canvas app using PythonAnywhere's Django web app. When creating a Django web app, I was asked to choose the Python version. 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. 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. This is what I find in the PythonAnywhere Error Log:

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 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.

1

There are 1 answers

1
Glenn On BEST ANSWER

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. You may have missed other steps, but I haven't checked fully.