chris4844
chris4844

Reputation: 1

Page not found (404) Request Method: GET

I keep getting this error:

admin/

home/ The current path, home, didn't match any of these.


This is my urls.py for the overall project

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


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

this is my code for hello_world urls.py

from django.urls import path
from hello_world import views

urlpatterns = [
    path('home/', views.hello_world, name='hello_world'),
]

this is my code for hello_world views.py

from django.shortcuts import render

def hello_world(request):
    return render(request, 'hello_world.html')

Upvotes: 0

Views: 2507

Answers (1)

Exprator
Exprator

Reputation: 27513

you need to change this url from

urlpatterns = [
    path('home/', views.hello_world, name='hello_world'),
]

to

urlpatterns = [
    path('', views.hello_world, name='hello_world'),
]

to get to http://127.0.0.1:8000/home/

else you need to goto http://127.0.0.1:8000/home/home/ for the current url

Upvotes: 1

Related Questions