ethor11
ethor11

Reputation: 47

Django Tutorial Constant 404 error urlpattern recognition

I have searched endlessly for a solution and I can't seem to find it, even though I know this has been asked before. I am encountering a perpetual 404 error from the django tutorial. It appears to me that the 'urlpatterns' isn't recognizing another option of than admin.


backend/urls.py

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

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

backend/meat/urls.py

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

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

backend/meat/views.py

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

def index(requests):
    return HttpResponse('Hello Wold')

Upvotes: 0

Views: 59

Answers (1)

Mohamed Shabeer kp
Mohamed Shabeer kp

Reputation: 882

In order to access views inside the meat app. you have included the urls of meat to the test/ path.

Thus you should use url /test/

if you are developing on local host then localhost:8000/test/

NB: I have tested this right now link

PS: try changing the path of admin site to path('admin/', admin.site.urls),

Upvotes: 1

Related Questions