Search code examples
pythondjangourl-pattern

Why am I seeing localhost:8000 empty path does not match Django?


I keep running into 'Page not found' when trying to load http://localhost:8000/ . I have an empty path set to direct the page to my project_index page, but this is all I get:

enter image description here

I have checked and re-checked all of my urlpatters, but cannot figure out where the problem is.

Here are all my urls.py scripts that correspond to this project:

personal_portfolio/: personal_portfolio/urls.py

projects/: projects/urls.py

blog/: blog/urls.py


Solution

  • You don't have anything starting with

    urlpatterns = [
              path("", ..... ),
    ]
    

    in your main urls.py.

    like all the URLs you defined has a suffix thus Django can't find it,

    either you need to do

    urlpatterns = [
              path("", include('project.urls') ),
    ]
    

    or

    urlpatterns = [
              path("", include('blog.urls') ),
    ]