M
M
Mike2017-03-27 03:45:41
Django
Mike, 2017-03-27 03:45:41

Why am I getting the error "django.db.utils.OperationalError: no such table: social_auth_usersocialauth"?

Installed "python-social-auth-django" . I'm trying to login to a site with Twitter and I'm getting that error. Basically, when I click on the link to login with twitter, Twitter asks for authorization permission and then says that you will be redirected back, then I get "django.db.utils.OperationalError: no such table: social_auth_usersocialauth".
my settings.py

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'fighter',
    'avatar',
    'social.apps.django_app.default',
]

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        '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',
                'django.template.context_processors.i18n',
                'django.template.context_processors.media',
                'django.template.context_processors.static',
                'django.template.context_processors.tz',
                'django.template.context_processors.csrf',
                'social.apps.django_app.context_processors.backends',
                'social.apps.django_app.context_processors.login_redirect',
            ],
        },
    },
]


AUTHENTICATION_BACKENDS = (
    # 'social.backends.facebook.FacebookOAuth2',
    # 'social.backends.google.GoogleOAuth2',
    'social.backends.twitter.TwitterOAuth',
    'django.contrib.auth.backends.ModelBackend',
)

# for Twitter
SOCIAL_AUTH_TWITTER_KEY = '****************'
SOCIAL_AUTH_TWITTER_SECRET = '************************'

LOGIN_REDIRECT_URL = '/demo'

I filled in the fields on the Twitter website when creating the application in this way:
Website I specified the one that I have on pythonanywhere, so simple, because with the name localhost: 8000 I received an error message, but this is a campaign of indifference ... .Callback
URL
127.0.0.1:8000/complete/twitter

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
devalone, 2017-03-27
@devalone

Probably need to create table python3 manage.py makemigrations app && python3 manage.py migrate

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question