Skip to content
Advertisement

Python from django.contrib.auth.views import logout ImportError: cannot import name ‘logout’

I have configured my python env with python 3.5, but I am getting the following error when I run my server with the command python manage.py runserver

from django.contrib.auth.views import logout
ImportError: cannot import name 'logout'

this is my config

dj-database-url==0.5.0
Django==2.1a.1
gunicorn==19.8.1
numpy==1.14.3
psycopg2==2.7.4
pytz==2018.4
whitenoise==4.0b4

I tried reinstalling my env and changing python version but issue stills happening.

Thanks for your questions guys

Advertisement

Answer

Hey looks like you are using the wrong django version, django.contrib.auth.views.logout is not available in your current django version, try downgrading your django version to a lower version with this command: sudo pip install Django==2.0.2 or change the import in order to use logout_view

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement