3

I am using python-social-auth. But when I run makemigrations and migrate. The tables "social_auth-*" are not created.

My settings.py looks like this

INSTALLED_APPS += (
    'social.apps.django_app.default',
)
AUTHENTICATION_BACKENDS += (
    'social.backends.facebook.FacebookOAuth2',
    'social.backends.google.GoogleOAuth2',
    'social.backends.twitter.TwitterOAuth',
)

SOCIAL_AUTH_USER_MODEL = AUTH_USER_MODEL

# Rausnehmen wenns Probleme mit der Auth. gibt

SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_details',
    'social.pipeline.social_auth.social_uid',
    'social.pipeline.social_auth.auth_allowed',
    'social.pipeline.social_auth.social_user',
    'social.pipeline.user.get_username',
    'social.pipeline.social_auth.associate_by_email',  # <--- enable this one. to match users per email adress
    'social.pipeline.user.create_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    'social.pipeline.user.user_details',
)

from sharadar.soc_auth_config import *

The same does work on another machine without any flaw. On this machine I receive :

Operations to perform:
    Apply all migrations: admin, auth, contenttypes, easy_thumbnailsguardian, main, myauth, sessions, social_auth
Running migrations:
    Applying myauth.0002_auto_20170220_1408... OK

social_auth is included here.

But on a new Computer I allways receive

Exception Value:    
relation "social_auth_usersocialauth" does not exist
LINE 1: ...er"."bio", "myauth_shruser"."email_verified" FROM "social_au...

When using google auth in my running django app

social_auth is not included when I run migrate

Operations to perform:
  Apply all migrations: admin, auth, contenttypes, easy_thumbnails, guardian, myauth, sessions
Running migrations:
  No migrations to apply.

Any help is appretiated.

Kind regards

Michael

mbieren
  • 1,034
  • 8
  • 31
  • do you have two computers with different setup? – Alexander Tyapkov Feb 20 '17 at 14:32
  • yes i have one computer with a working setup. But I cannot get it to run on the second – mbieren Feb 20 '17 at 14:34
  • Probably n your old setup python-social-auth migrations has been run after the migrations of the custom user model. I mean the sequence of migrations can matter in this case. You can try to disable python social auth in new setup, run migrations and then install it. – Alexander Tyapkov Feb 20 '17 at 15:12
  • I have uninstalled python-social-auth. Removed it from installed apps. Recreated the database only with "my" migrations. Reinstalled social-auth and rerun makemigrations and migrate still just my apps ;-( no social_auth – mbieren Feb 21 '17 at 09:14
  • do you have some custom config from sharadar.soc_auth_config import *? – Alexander Tyapkov Feb 21 '17 at 10:43
  • just links like : SOCIAL_AUTH_TWITTER_KEY = 'xxxxxxxxxxxxxxx' SOCIAL_AUTH_TWITTER_SECRET = 'xxxxxxxxxxxxxxxx' Keys for GOOGLE and FACEBOOK as well. Can I run makemigrations and migrate more verbosely ? – mbieren Feb 21 '17 at 11:01
  • you mean something similar to this one? http://stackoverflow.com/a/5897509/709897 – Alexander Tyapkov Feb 21 '17 at 12:06
  • on the machine where it is working I receive – mbieren Feb 22 '17 at 08:47
  • ....... ....... Running pre-migrate handlers for application myauth Running pre-migrate handlers for application main Running pre-migrate handlers for application social_auth – mbieren Feb 22 '17 at 08:48
  • and where it is not working I receive – mbieren Feb 22 '17 at 08:49
  • Ah ... a lot of migrations are missing ... I will have a look on that – mbieren Feb 22 '17 at 08:50

2 Answers2

1

I had to migrate to social-auth-core as described in this dokument :

Migrating from python-social-auth to split social

Then all is working fine. But after this problems I am thinking about changing to all-auth.

Regards for any help

mbieren
  • 1,034
  • 8
  • 31
0

Strange .. when entering the admin interface I receive the exception :

No installed app with label 'social_django'.

But later in the Error Report I have :

INSTALLED_APPS  
    ['django.contrib.admin',
     'django.contrib.auth',
     .....
     'myauth.apps.MyauthConfig',
     'main.apps.MainConfig',
     'social.apps.django_app.default']

pip3 search for python-social-auth gives :

python-social-auth (0.3.6) 
    INSTALLED: 0.3.6 (latest)

I dont know what is going on here.

Regards

Michael

mbieren
  • 1,034
  • 8
  • 31
  • Initially not. But to crosscheck. I also created a virtualenv and I do receive the same problem there as well. The migrations are not performed. Tables are not created. – mbieren Feb 23 '17 at 10:18
  • I even created a empty new project "mysite" with one app "polls" and included python-social-auth in installed_apps there, The migrations are not performed whatever I do ? – mbieren Feb 23 '17 at 10:35
  • michael@mibi:~/tmp/mysite$ python manage.py migrate Operations to perform: Apply all migrations: admin, auth, contenttypes, sessions Running migrations: No migrations to apply. michael@mibi:~/tmp/mysite$ – mbieren Feb 23 '17 at 10:35