Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django错误{未找到页面,错误404},_Python_Django - Fatal编程技术网

Python Django错误{未找到页面,错误404},

Python Django错误{未找到页面,错误404},,python,django,Python,Django,[目录]尝试连接时出现此错误 Using the URLconf defined in project.urls, Django tried these URL patterns, in this order: admin/ The current path, polls/, didn't match any of these. C:\Users\Kwaku-Biney\Desktop\dj\mysite\polls\url.py from django.urls import pat

[目录]尝试连接时出现此错误

Using the URLconf defined in project.urls, Django tried 
these URL patterns, in this order:

admin/
 The current path, polls/, didn't match any of these.
C:\Users\Kwaku-Biney\Desktop\dj\mysite\polls\url.py

 from django.urls import path
  from . import views
urlpatterns = [
path('', views.index, name='index'),]
C:\Users\Kwaku-Biney\Desktop\dj\mysite\mysite\url.py

 from django.contrib import admin
 from django.urls import include, path

 urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),]
mysite\polls\views.py

 from django.shortcuts import render
 from django.http import HttpResponse
 def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
设置.py

 # Application definition

 # Application definition

  INSTALLED APPS= [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'polls',]
polls/apps.py

from django.apps import AppConfig
class PollsConfig(AppConfig):
   name = 'polls'
mysqite/mysite/url.py

from django.contrib import admin
from django.urls import path,include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('polls/',include('polls.urls'))
]
mysite/polls/url.py

from django.urls import path,include
from . import views
urlpatterns = [
    path('', views.index),
]
mysite/polls/views.py

from django.shortcuts import render

from django.http import HttpResponse
def index(request):
    return HttpResponse("Hello, world. You're at the polls index.")

运行服务器后,问题是我没有保存文件。通过在windows上的VSCode中按CTRL+K+S来实现


您也可以通过菜单栏上的File=>AutoSave来打开VsCode上的AutoSave。

在设置中,ROOT\u URLCONF中的内容是什么?ROOT\u URLCONF='mysite.urls'您可以添加polls/apps.py吗?@BriseBalloches添加了它now@KwakuE.Biney您是否可以添加错误的屏幕截图而不是错误本身