Tivix / django-rest-auth

This app makes it extremely easy to build Django powered SPA's (Single Page App) or Mobile apps exposing all registration and authentication related functionality as CBV's (Class Base View) and REST (JSON)
www.tivix.com
MIT License
2.41k stars 661 forks source link

User delete fails if allauth.socialaccount is not in INSTALLED_APPS #412

Open sredman opened 6 years ago

sredman commented 6 years ago

This looks like a re-occurrence of #71 I have a users Viewset which has a delete method (Nothing fancy, just added rest_framework.mixins.DestroyModelMixin) When I try to delete, the server responds with this error:

no such table: allauth_socialaccount

Request Method: DELETE
Request URL: http://localhost:8000/users/8/
Django Version: 1.11.7
Python Version: 2.7.14
Server time: Tue, 20 Feb 2018 06:31:44 +0000
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'rest_framework',
 'rest_auth',
 'django.contrib.sites',
 'allauth',
 'allauth.account',
 'rest_auth.registration',
 'api',
 'rest_framework_swagger',
 'corsheaders',
 'dynamic_rest']

However, if I add allauth.socialaccount and remake and apply migrations, everything works fine

It looks like the fix in #107 is no longer present. Moreover, applying it to today's code doesn't seem to solve the problem.

Alig1493 commented 6 years ago

If anyone isn't working on this issue I'd like to take it up. Is there any one here who'd like to provide me some guidelines as to how I should tackle this problem?

RikSchoonbeek commented 6 years ago

I'm also running into the same issue.

After adding 'allauth.socialaccount' to my INSTALLED_APS and running migrations, the problem is gone.

sdozier commented 6 years ago

rest_auth's documentation lists allauth.socialaccount as optional, but django-allauth says it is required, so maybe that's the issue?

Sure you can install the app as a workaround, but it's cluttering and confusing to have four empty database tables that we're not using at all. I wonder why socialaccount is required, social login seems pretty darn optional as features go :/

jasonwirth commented 6 years ago

I was using drf-auth and got errors deleting a user too.

Solution by @RikSchoonbeek worked for me.

Adding 'allauth.socialaccount', corrected the issue. (https://django-allauth.readthedocs.io/en/latest/installation.html)

INSTALLED_APPS = [
   ...    
    'django.contrib.sites',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',  # Added this
    'rest_auth.registration',
    ...
]
mzerara commented 4 years ago

Once you include 'allauth.socialaccount' in your installed_apps the problem should be gone. Make sure to make migrations and migrate

florianmartens commented 4 years ago

I also found this confusing in 2020.