我刚刚从Django开始,我对网络发展感到触动,因此,这可能是一件容易的事。 我从正式文件中穿过Django Polls Tutorial,我几乎碰到了一个问题。 I m没有成功访问http:// localhost:8000/polls/。 我收到错误......
Page not found (404) Request Method: GET Request URL: http://localhost:8000/polls/ Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
admin/ The current path, polls/, didn’t match any of these.
我的相关守则......
mysitepollsviews.py
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world. You re at the polls index.")
mysitepollsurls.py
from django.urls import path
from . import views
urlpatterns = [
path( , views.index, name= index ),
]
mysiteurls.py
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path( polls/ , include( polls.urls )),
path( admin/ , admin.site.urls),
]
mysitemysitesetting.py
INSTALLED_APPS = [
django.contrib.admin ,
django.contrib.auth ,
django.contrib.contenttypes ,
django.contrib.sessions ,
django.contrib.messages ,
django.contrib.staticfiles ,
]
ROOT_URLCONF = mysite.urls
www.un.org/Depts/DGACM/index_spanish.htm 发展服务器是。
Not Found: /polls/ [06/Dec/2022 15:02:01] "GET /polls/ HTTP/1.1" 404 2095
我曾尝试过我从其他类似的辅导站那里看到的固定装置,但没有任何工作,我感到,我像我一样,在这个黑暗中tab。
Thank you Hash & Carlos for taking a look. I modified as suggested, and restarted server, but I get the exact same result...
mysitedings.py
INSTALLED_APPS = [
django.contrib.admin ,
django.contrib.auth ,
django.contrib.contenttypes ,
django.contrib.sessions ,
django.contrib.messages ,
django.contrib.staticfiles ,
polls ,
]
我感到,尽管有一条简单的道路错误,却发生了一些how。 我的集延戈是否会有错误? 我确实看到了当地座椅:8000,正如我所应当的那样。