South migration for social auth

主宰稳场 提交于 2019-12-02 09:36:48

I don't think you need to generate migrations for social_auth, since this app should already have its migrations. Rather, you need to execute them, so after you added 'social_auth' in your settings you have to run only this command:

python manage.py migrate social_auth

django-social-auth works perfectly except that it needs South and it doesn't work with newer versions of Django.

To remove the dependencies form South in django-social-auth, simply remove the migrations created by South and create new ones using the newer migration engine from Django 1.7 >.

This is how I fixed it:

# Install django (if you haven't) and django-social-auth
(my_venv)$ pip install django django-social-auth

# Delete the South migrations
# Using a virtual environment: my_venv
# In case you use python3, replace
(my_venv)$ rm <path_to_my_venv>/lib/python2.7/site-packages/social_auth/migrations/000*

# Create an dummy django project
(my_venv)$ django-admin startproject asdf

Add django-social-auth to the asdf/settings.py file

### asdf/asdf/settings.py
...
INSTALLED_APPS = (
    ...
    'social_auth',
)
...

Finally create the new migration for django-social-auth

# Create new migrations
$ python asdf/manage.py makemigrations social_auth

# Delete the dummy django-project
$ rm -r asdf

This fix will work for all the Django projects that work under the same virtual environment.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!