ModuleNotFoundError: No module named 'django.shortcuts'

Viewed 707

I am creating a bookstore website using the Django framework and this error can't be resolved after various StackOverflow previous solutions.

File "E:\django\bookstore\book\urls.py", line 3, in <module>
    from django.contrib.auth import views as auth_views
  File "E:\django\env\lib\site-packages\django\contrib\auth\views.py", line 9, in <module>
    from django.contrib.auth.decorators import login_required
  File "E:\django\env\lib\site-packages\django\contrib\auth\decorators.py", line 7, in <module>
    from django.shortcuts import resolve_url
ModuleNotFoundError: No module named 'django.shortcuts'

This is my views.py

from django.shortcuts import render,redirect
from django.http import HttpResponse
from django.contrib.auth import login,logout,authenticate
from .models import *
from .forms import *

Apart from this, I also have 2 venv config files in the env directory. what should I do about them — should one of them be deleted?

enter image description here

1 Answers

django.shortcuts is not the django-shortcuts package. It is this:

enter image description here

If your django package does not contain it, could you try to reinstall the django?

enter image description here

enter image description here

enter image description here

Related