Bahog Tae
Bahog Tae

Reputation: 13

Django 404 error GET Request URL: http://localhost:8000/ keeps popping up when blank url is requested

I was following this tutorial by tom artyn.

My code was exactly as his in the book, however, everytime i try to render my web page on the localhost server, i keep getting Page not found (404) Error.

Here is my project(config) url:

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

import core.urls

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

Here is my app(core) url:

from django.urls import path
from . import views


app_name ='core'
urlpatterns = [
    path('movies', views.MovieList.as_view(), name = 'MovieList'),
    ]

Here is my app(core) view:

from django.views.generic import ListView

from core.models import Movie


# Create your views here.
class MovieList(ListView):
    model = Movie

Here is my app(core) admin:

from django.contrib import admin

# Register your models here.

from core.models import Movie

admin.site.register(Movie)

I have no clue why request doesn't match the '' url.

Page not found (404)
Request Method: GET
Request URL:    http://localhost:8000/
Using the URLconf defined in config.urls, Django tried these URL patterns, in this order:

admin/
movies [name='MovieList']
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.

Upvotes: 1

Views: 922

Answers (1)

Amir Afianian
Amir Afianian

Reputation: 2795

You are requesting the following:

http://localhost:8000/

But, you have not created any route for that. What you can try are the followings according to your urlconf:

localhost:8000/admin/
localhost:8000/core/movies

Upvotes: 1

Related Questions