【发布时间】:2020-10-07 01:05:34
【问题描述】:
刚开始学习Django,遇到如下错误:
[![The site doesn't see URL and then Error 404][1]][1]
urls.py - 网站
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('webexample/', include ('webexample.urls')),
]
urls.py - 网络示例
from django.urls import path
from . import views
urlpatterns = [
path(r'^$', views.index, name='index'),
]
views.py - webexample
from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return HttpResponse("<h3>This page isn't set up yet...</h3>")
【问题讨论】: