这里写目录标题
- 一级目录
- 1. 访问Django项目,python web url时,报错
- 2. 传参报名,python web url时,报错
- 正确访问结果:
- 二、购买价格 和 见错误码
一级目录
1. 访问Django项目,python web url时,报错
<div id="explanation"><p>You’re seeing this error because you have <code>DEBUG = True</code> inyour Django settings file. Change that to <code>False</code>, and Djangowill display a standard 404 page.</p></div>
原程序如下 :
from django.urls import pathfrom ltjt_aiseek_app.com.ltjt.web import views# from. import viewsurlpatterns = [# 这里可以添加具体的路由映射,例如:# path('chat/', views.chat, name='chat'),# 不行的话 再把views 放到根目录下来# 'chat/' 后面带不带/ 决定了访问时 http://localhost:9000/api/chat 的最后要不要 http://localhost:9000/api/chat/path('chat/', views.chat, name='chat'),# path('chat', views.chat, name='chat'),
]
第1次访问Url 结尾不带 ”/“
http://localhost:9000/api/chat
第2次访问Url 结尾不带 ”/“
http://localhost:9000/api/chat/
带 ”/" 不方便,选择修改程序 urls.py,路由映射中去年 “/”
2. 传参报名,python web url时,报错
Internal Server Error: /api/chat
Traceback (most recent call last):File "D:\Users\wang\IdeaProjects\ltkj_git\ltjt-ai-seek\seek_backend_py\ltjt_aiseek_app\com\ltjt\web\views.py", line 37, in chattongyi_response = tongyi_llm.chat(messages)File "D:\Users\wang\IdeaProjects\ltkj_git\ltjt-ai-seek\seek_backend_py\ltjt_aiseek_app\com\ltjt\models\tongyiqianwen.py", line 24, in chat"role": msg["role"],
TypeError: string indices must be integers
During handling of the above exception, another exception occurred:
messages = [{"role": "user","content": "介绍一下故宫"}]
正确访问结果:
哪些是有用的值,哪些需要保存