page not found

hi, I’m a beginner, so excuse me.

I followed a tutorial
who made me set up the file urls.py

from django.contrib import admin
from django.urls import path
from rolls import views

urlpatterns = [
path(‘admin/’, admin.site.urls),
path(‘rolls/’, views.rolls,)
]

and the file views.py

def rolls (request):
return render(request,‘rolls/rolls.html’,)

as soon as I added this line
path(‘rolls/’, views.rolls,)

the site did not work anymore and gives me this error

Page not found (404)

Request Method: GET
Request URL: http://127.0.0.1:8000/

Using the URLconf defined in ciao.urls , Django tried these URL patterns, in this order:

  1. admin/
  2. rolls/

The empty path didn’t match any of these.

You’re seeing this error because you have DEBUG = True in your Django settings file. Change that to False , and Django will display a standard 404 page.

Does anyone know where the mistake is?

thanks

The error isn’t cause by adding that line. You either removed a line or else this never worked before.

The error message really is rather straight-forward. You tried to go to a blank url (http://127.0.0.1:8000/), but you don’t have a blank url defined in your urls.py file.

so what should I do?

I don’t know. It depends upon what you want to have happen when someone goes to a blank url. Or, if you even want to go to a blank url to begin with. You might be missing an entry somewhere, or you might be going to the wrong url at this stage of the tutorial.

I don’t know what tutorial you’re trying to follow to be able to advise you. The only tutorials that I’m familiar with and recommend to people are the Official Django Tutorial and the Django Girls Tutorial.

You have to go to http://127.0.0.1:8000/rolls/ in order to see your rolls.html template.