Home > database >  Django still shows home page rather than the page that I want
Django still shows home page rather than the page that I want

Time:06-13

I am learning django now for the first time and I am a bit stuck at the start . Please help me out here.

I created a new project through django and created a blog page inside my project through terminal(cmd). Directory was also formed for both in my PC. When I run the server, localhost also shows "Installed worked Successfully"(attached).

Now for the 2nd step was to include a blog page in there. So I have made changes in "views.py", "urls.py" in both Project and blog directory(attached). Now as of the tutorial I am following, now when I run my local host, it should not show the same "Installed Successfully" page but rather should give Error 404 of page not found(attached). And in my address bar when I give "localhost:8000/blog", then it should show a blog page. But for me it still shows the "Installed Successfully" page.

I tried this twice separately, maybe I missed something but can't figure it out.

Thanks.

Installed Successfully views.py urls-blog urls-project Error that should shown according to tutorial

CodePudding user response:

From your settings/urls.py change

path('blog/', include('blog.urls') 

to

path('', include('blog.urls')

CodePudding user response:

you have added blog/ in your url. to browse write in browser url localhost:8000/blog/

Or you can just remove blog word

path('blog/', include('blog.urls') 

path('', include('blog.urls') 

then you can visit by localhost:8000

  • Related