页面http://127.0.0.1:8000/category.html/
抛出404,
说
Using the URLconf defined in ddblog2.urls, Django tried these URL
patterns, in this order:
admin/
^ [name='index']
^ category [name='category']
The current path, category.html/, didn't match any of these.
ddblog2 / ddblog2 / urls.py如下:
from django.conf.urls import url, include
from django.contrib import admin
from django.urls import path
from . import views
urlpatterns = [
path('admin/', admin.site.urls),
url(r'^', include('blog.urls')),
]
ddblog2 / blog / urls.py如下:
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('category/', views.category, name = 'category')
]
ddblog2 / blog / views.py:
from django.shortcuts import render
def index(request):
return render(request, 'index.html', {})
def category(request):
return render(request, 'category.html', {})
“博客”已添加到INSTALLED_APPS
如何纠正此错误?
答案 0 :(得分:-1)
您需要将html添加到ddblog2 / blog / templates / blog /