Robby
Robby

Reputation: 193

Django No module named backendssocial.apps.django_app.context_processors

I'm adding an authentication via facebook and when I run my localhost I'm getting this error in terminal:

xx-MacBook-Pro:bookstore xx$ python manage.py runserver
/Library/Python/2.7/site-packages/django/db/models/fields/subclassing.py:22: RemovedInDjango110Warning: SubfieldBase has been deprecated. Use Field.from_db_value instead.
  RemovedInDjango110Warning)

/Library/Python/2.7/site-packages/django/db/models/fields/subclassing.py:22: RemovedInDjango110Warning: SubfieldBase has been deprecated. Use Field.from_db_value instead.
  RemovedInDjango110Warning)

Performing system checks...

/Library/Python/2.7/site-packages/social/apps/django_app/urls.py:12: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got auth). Pass the callable instead.
  name='begin'),

/Library/Python/2.7/site-packages/social/apps/django_app/urls.py:14: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got complete). Pass the callable instead.
  name='complete'),

/Library/Python/2.7/site-packages/social/apps/django_app/urls.py:17: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got disconnect). Pass the callable instead.
  name='disconnect'),

/Library/Python/2.7/site-packages/social/apps/django_app/urls.py:19: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got disconnect). Pass the callable instead.
  'disconnect', name='disconnect_individual'),

/Library/Python/2.7/site-packages/social/apps/django_app/urls.py:19: RemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.
  'disconnect', name='disconnect_individual'),

System check identified no issues (0 silenced).
September 12, 2016 - 19:22:13
Django version 1.9, using settings 'bookstore.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

I'm guessing that the bottom portion of this is simply saying that the newer version of Django will be different. I'm also guessing that the top portion is saying there there is a warning leading up to it. However, when I actually go to the localhost I get this error:

Request Method: GET
Request URL: http://localhost:8000/store/

Django Version: 1.9
Python Version: 2.7.10
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'social.apps.django_app.default',
 'registration',
 'store']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback:

File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response
  149.                     response = self.process_exception_by_middleware(e, request)

File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response
  147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/Users/rseck/Desktop/stoneriverelearning/bookstore/store/views.py" in store
  17.     return render(request, 'store.html', context)

File "/Library/Python/2.7/site-packages/django/shortcuts.py" in render
  67.             template_name, context, request=request, using=using)

File "/Library/Python/2.7/site-packages/django/template/loader.py" in render_to_string
  97.         return template.render(context, request)

File "/Library/Python/2.7/site-packages/django/template/backends/django.py" in render
  95.             return self.template.render(context)

File "/Library/Python/2.7/site-packages/django/template/base.py" in render
  204.                 with context.bind_template(self):

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py" in __enter__
  17.             return self.gen.next()

File "/Library/Python/2.7/site-packages/django/template/context.py" in bind_template
  256.         processors = (template.engine.template_context_processors +

File "/Library/Python/2.7/site-packages/django/utils/functional.py" in __get__
  33.         res = instance.__dict__[self.name] = self.func(instance)

File "/Library/Python/2.7/site-packages/django/template/engine.py" in template_context_processors
  105.         return tuple(import_string(path) for path in context_processors)

File "/Library/Python/2.7/site-packages/django/template/engine.py" in <genexpr>
  105.         return tuple(import_string(path) for path in context_processors)

File "/Library/Python/2.7/site-packages/django/utils/module_loading.py" in import_string
  20.     module = import_module(module_path)

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py" in import_module
  37.     __import__(name)

Exception Type: ImportError at /store/
Exception Value: No module named backendssocial.apps.django_app.context_processors

When I pip freeze I see that I have python-social-auth==0.2.7, so I'm not sure what is causing all this.

This is parts of my settings.py file:

INSTALLED_APPS = [
  'django.contrib.admin',
  'django.contrib.auth',
  'django.contrib.contenttypes',
  'django.contrib.sessions',
  'django.contrib.messages',
  'django.contrib.staticfiles',
  'social.apps.django_app.default',
  'registration',
  'store',
]
TEMPLATES = [
{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [os.path.join(BASE_DIR, 'templates')],
    'APP_DIRS': True,
    'OPTIONS': {
        'context_processors': [
            'django.template.context_processors.debug',
            'django.template.context_processors.request',
            'django.contrib.auth.context_processors.auth',
            'django.contrib.messages.context_processors.messages',
            'social.apps.django_app.context_processors.backends'
            'social.apps.django_app.context_processors.login_redirect'
        ],
    },
},
]
WSGI_APPLICATION = 'bookstore.wsgi.application'

AUTHENTICATION_BACKENDS = (
    'social.backends.facebook.FacebookOAuth2',
    'django.contrib.auth.backends.ModelBackend'
)
# Registration
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_AUTO_LOGIN = True
LOGIN_REDIRECT_URL ='/store/'

# Email settings
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "smtp.gmail.com"
EMAIL_HOST_USER = "[email protected]"
EMAIL_HOST_PASSWORD = "xx"
EMAIL_PORT = 587
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = "[email protected]"

# Social Auth - Facebook
SOCIAL_AUTH_FACEBOOK_KEY = 'xx'
SOCIAL_AUTH_FACEBOOK_SECRET = 'xx'

In advance, thank you for your help!

Upvotes: 1

Views: 308

Answers (1)

vishes_shell
vishes_shell

Reputation: 23564

You are missing one comma in TEMPLATES variable:

'context_processors': [
    'django.template.context_processors.debug',
    'django.template.context_processors.request',
    'django.contrib.auth.context_processors.auth',
    'django.contrib.messages.context_processors.messages',
    'social.apps.django_app.context_processors.backends' <--- MISSING COMMA
    'social.apps.django_app.context_processors.login_redirect'
],

Upvotes: 2

Related Questions