第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 SQLite3 找不到 Django 頁面

使用 SQLite3 找不到 Django 頁面

MMTTMM 2023-08-22 15:03:25
不知道為什么我會收到此錯誤,因為我的 ToDoList 中只有 1 個名為“Habibs List”的項目,但是當(dāng)我轉(zhuǎn)到http://127.0.0.1:8000/Habibs%20List時,它給了我這個錯誤:Page not found (404)Request Method: GETRequest URL:    http://127.0.0.1:8000/Habibs%20ListUsing the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:admin/<int:id> [name='index']The current path, Habibs List, didn't match any of these.在我看來:def index(response, name):    ls = ToDoList.objects.get(name=name)    item = ls.item_set.get(id=1)    return HttpResponse("<h1>%s</h1><br></br><p>%s</p>" % (ls.name, str(item.text)))# def v1(response):#     return HttpResponse("<h1>Game Page</h1>")# def v2(response):#     return HttpResponse("<h1>Electronic Page</h1>")我的網(wǎng)址配置:# the path to our different web pages# like the different views we have in our filefrom django.urls import pathfrom . import viewsurlpatterns = [    path("<int:id>", views.index, name="index"),]
查看完整描述

1 回答

?
哆啦的時光機

TA貢獻1779條經(jīng)驗 獲得超6個贊

您只需將 url 路徑更改為path("<str:name>/", views.index, name="index")



查看完整回答
反對 回復(fù) 2023-08-22
  • 1 回答
  • 0 關(guān)注
  • 1602 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號