python-social-auth v0.2 to v0.3 migration steps

Introduction

Basically everything is written here. https://github.com/omab/python-social-auth/blob/master/MIGRATING_TO_SOCIAL.md

Since the package of python-social-auth has been subdivided since v0.3, it seems that it is necessary to add the package and change the setting.

Rewrite

The commented out part is the rewritten part.

settings.py


INSTALLED_APPS = [
    # 'social.apps.django_app.default',
    'social_django',
]

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates'),],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                # 'social.apps.django_app.context_processors.backends',
                # 'social.apps.django_app.context_processors.login_redirect',
                'social_django.context_processors.backends',
                'social_django.context_processors.login_redirect',
            ],
        },
    },
]

AUTHENTICATION_BACKENDS = [
    # 'social.backends.twitter.TwitterOAuth',
    'social_core.backends.twitter.TwitterOAuth',
    'django.contrib.auth.backends.ModelBackend',
]

urls.py


urlpatterns = [
    # url(r'^social/', include('social.apps.django_app.urls', namespace='social')),
    url(r'^social/', include('social_django.urls', namespace='social')),
]

upgrade

# python-social-Upgrade auth installs a lot of related packages
pip install -U python-social-auth
#Install additional packages for Django
pip install social-auth-app-django

# migrate
python manage.py migrate

Recommended Posts

python-social-auth v0.2 to v0.3 migration steps
Migrating from Chainer v1 to Chainer v2
Update python-social-auth from 0.1.x to 0.2.x
Steps to develop Django with VSCode
Steps to install MySQL 8.0 on CentOS 8.1
Steps to create a Django project
Steps to install Ubuntu in VirtualBox
Steps to install VirtualBox on CentOS
Steps to install python3 on mac