Section 12 - 12- Building Web Applications with Django - Lesson 4- views: ModuleNotFoundError: No module named 'movies.urls'

This is my code in urls.py inside vidly.

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('movies/', include('movies.urls'))  
]

This is my code inside urls.py inside movies.


from django.urls import path
from . import views

urlpatterns = [
  path('', views.index, name='index')  # An empty string represents the root of this app. Pass a reference to index function. Don't call it with ().
]

Here is code in views.py inside app movies.

from django.shortcuts import render  
from django.http import HttpResponse

def index(request):  # django uses request object so we have to pass it to function index.
  return HttpResponse("Hello World")

Why do I get the error shown below:

ModuleNotFoundError: No module named ‘movies.urls’

The instructor gets this erros because he forget the ‘s’ in ‘movies.urls’ and types it as ‘movies.url’ then he corrects it to ‘movies.urls’ and it works for him but it does not work for me and I still get ModuleNotFoundError: No module named ‘movies.urls’.

Here is the directory structure of the project.

Please help.

You misspelled urls.py within movies, it shows as ulrs.py

1 Like