我想在服務(wù)器中顯示一個(gè)簡(jiǎn)單的問候,但收到錯(cuò)誤消息“找不到頁面”。這是我的代碼:Analytic_web.urls.pyfrom django.contrib import adminfrom django.urls import include, path urlpatterns = [ path(r'jas/', include('website.urls')), path('admin/', admin.site.urls),]website.urls.py:from django.urls import pathfrom . import viewsurlpatterns = [ path(r'jas/', views.home, name='home'),]views.py:from django.shortcuts import renderfrom django.http import HttpResponsedef home(request): return render(request, '/templates/website/home.html' )主頁.html:<h1>Helllllllloooooooooowwwwwwwwwwwww</h1>
1 回答

紫衣仙女
TA貢獻(xiàn)1839條經(jīng)驗(yàn) 獲得超15個(gè)贊
在 website.urls.py 中,嘗試:
path('', views.home, name='home'),
而不是這個(gè)
path(r'jas/', views.home, name='home'),
并在 Analytic_web.urls.py 中嘗試:
path('jas/', include('website.urls')),
而不是這個(gè)
path(r'jas/', include('website.urls')),
希望這會(huì)有所幫助。
添加回答
舉報(bào)
0/150
提交
取消