Forums

Import error

.

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

Hello guys, am getting this error on my bash, these two login and logout are inbuilt views which i have imported!how to overcome this problem

[edit by admin: formatting]

Those have moved in Django 2.x -- it looks like your code must have been written for an earlier version.

You can either update your code to be compatible with Django 2, or you can use a virtualenv to use an older version of Django -- the instructions on that help page are talking about using one to use a newer version of Django than the one we have installed, but the process is the same if you want to use an older one instead.