django-rest-auth icon indicating copy to clipboard operation
django-rest-auth copied to clipboard

User delete fails if allauth.socialaccount is not in INSTALLED_APPS

Open sredman opened this issue 7 years ago • 6 comments

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.

sredman avatar Feb 20 '18 06:02 sredman

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?

Alig1493 avatar Mar 22 '18 20:03 Alig1493

I'm also running into the same issue.

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

RikSchoonbeek avatar Jun 14 '18 12:06 RikSchoonbeek

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 :/

sdozier avatar Jun 26 '18 22:06 sdozier

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',
    ...
]

jasonwirth avatar Oct 07 '18 19:10 jasonwirth

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

mzerara avatar Apr 03 '20 18:04 mzerara

I also found this confusing in 2020.

florianmartens avatar Sep 11 '20 10:09 florianmartens