前面一路过来都正确,在后面步骤中出错了,是哪个原因
Page not found (404)
Request Method:GETRequest URL:http://127.0.0.1:8000/blog/index/Using the URLconf defined in myblog.urls, Django tried these URL patterns, in this order:
The current path, blog/index/, 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.
python3.6+django2.0
url.py如下:
from django.contrib import adminfrom django.urls import pathfrom blog import viewsurlpatterns = [ path('admin/', admin.site.urls), path('blog/', views.index),views.py如下:
from django.shortcuts import renderfrom blog import modelsdef index(request): article = models.Article.objects.get(pk=1) return render(request, 'blog.html', {'article': article}) |
免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。
版权声明:作者保留权利,不代表天盟立场。
|
|
|
|