python - 在 Django 服务器上找不到页面 404?
问题描述
我正在上 Django 课程,只有在我的第一个教程中,我在将 URL 映射到视图时收到“发现 404 错误页面”。我参考了此链接并执行了相同的步骤,但仍然遇到相同的错误。
https://docs.djangoproject.com/en/3.0/intro/tutorial01/
polls/urls.py
-------------
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
polls/view.py
-------------
from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
mysite/urls.py
--------------
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]
帮我解决错误...我检查了所有来源并完全按照链接...仍然无法正常运行
解决方案
推荐阅读
- download - 如何解决 eta 0:00:01Killed?
- sql - Oracle 在 case 语句和插入中使用引号的区别
- hibernate - 如何使用 JPA + Rest 服务将数据插入外键列
- android - org.gradle.api.ProjectConfigurationException:更新到 AndroidStudio - 3.5.3 后配置根项目时出现问题
- reactjs - React dnd broad 无法处理打字稿
- javascript - JavaScript 本地存储未在另一个文件中显示正确的值
- arrays - 任何数组中的最小和最大数
- html - 有没有办法做出这样的设计,并使其响应?
- javascript - 无法使用 javascript 显示我的号码
- excel - Power Query 中的动态日期查询