I'm learning Django and I'm trying to get a blog application running but I keep getting the same error: page not found error
I even went to the files available in github link which are the endgoal (while slightly different) I imported the whole mysite folder, opened a virtual env, installed Django, pushed the migrations and ran the server but I still get the same error.
It seems the problem arises with both my code and with the reference code in the github files.
CodePudding user response:
You don't target the good url.
According to your project url showed in the error, you have admin/
and blog/
Then try http://localhost:8000/blog
instead of http://localhost:8000/
CodePudding user response:
For any one encountering the same problem:
as Rvector stated the http://localhost:8000/blog is what we're supposed to use in the tutorial but I was just reading without paying neough attention and got hung up on the page not found error.
As an alternative replacing the
urlpatterns = [
path('admin/', admin.site.urls),
path('blog/', include('blog.urls', namespace='blog')),
]
in urls.py in the mysite folder with
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('blog.urls', namespace='blog')),
]
will make the blog page run as the home page and http://127.0.0.1:8000/ will work fine, seems obvious now but I guess reading more slowly can save you a lot of time.