Python 如何在web开发环境中定义URL路径
我正在开发一个应用程序,它有一个课程、章节和课程的层次结构。 一门课程不包含一章&一章包含多节课。所以我已经定义了下面提到的URL,所以如果需要更改,我只想听听你们的建议 /课程 /课程/ /章/ /章// /教训//Python 如何在web开发环境中定义URL路径,python,flask,Python,Flask,我正在开发一个应用程序,它有一个课程、章节和课程的层次结构。 一门课程不包含一章&一章包含多节课。所以我已经定义了下面提到的URL,所以如果需要更改,我只想听听你们的建议 /课程 /课程/ /章/ /章// /教训// /课程//如果您想要分级URL,我将使用以下内容: /courses/ /courses/<:course_id> /courses/<:course_id>/chapters/ /courses/<:course_id>/chapters/&
/课程//如果您想要分级URL,我将使用以下内容:
/courses/
/courses/<:course_id>
/courses/<:course_id>/chapters/
/courses/<:course_id>/chapters/<:chapter_id>
/courses/<:course_id>/chapters/<:chapter_id>/lessons/
/courses/<:course_id>/chapters/<:chapter_id>/lessons/<:lesson_id>
谢谢你的建议。
/courses
/courses/<:course_id>
/courses/<:course_id>/chapters/
/chapters/<:chapter_id>
/chapters/<:chapter_id>/lessons/
/lessons/<:lesson_id>
GET /courses/123
{
'title': 'My course',
...
'chapters': [{
'url': '/chapters/456'
'title': 'Chapter 1'
}]
}