这些是我为创建wepapp而编写的主要代码,但我收到了404错误,请提供帮助 my hello URL.py
from django.urls import path
from hello import views
urlpatterns = [
path("", views.index, name="index")
]
我的URL.py
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('admin/', admin.site.urls),
path('hello/', include("hello.urls")),
]
我的观点
from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
def index(request):
return HttpResponse("hello, orld")
看起来您正试图使用访问
index
http://127.0.0.1:8000/
。这将不起作用,因为您的index
包含在hello
的url.py中,并且hello
的url以hello/
开头试一试
相反
相关问题 更多 >
编程相关推荐