Search code examples
python-3.xdjangodjango-rest-frameworkdjango-allauth

ImportError: allauth needs to be added to INSTALLED_APPS


I've been following this tutorial on the django for apis book by William Vincent. I need to use django-allauth. I've installed it in my venv, added it to installed apps and done all the necessary things according to the installation instructions on the Documentation. On running python manage.py migrate , the error comes back as ImportError: allauth needs to be added to INSTALLED_APPS.

This is my settings.py in the relevant areas

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "django.contrib.sites",

    # 3rd party libraries
    "rest_framework",
    "corsheaders",
    "rest_framework.authtoken",
    "allauth",
    "allauth.account",
    "allauth.socialaccount",
    "dj_rest_auth",
    "dj_rest_auth.registration",

    # Local
    "accounts",
    "posts",
]
......

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.request",
            ],
        },
    },
]
....

AUTHENTICATION_BACKENDS = [
    "django.contrib.auth.backends.ModelBackend",
    "allauth.account.auth_backends.AuthenticationBackend",
]

I appreciate the help in advance.

I tried checking the documentation, checked all the commas were put in the appropriate place. Looked for similar situations on reddit and stackoverflow but coudln't find anything along that line.


Solution

  • Its a problem with the latest version of allauth, dj_rest_auth is not compatible yet. Change your allauth version on your pipfile to 0.54.0

    django-allauth = "==0.54.0"