Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在web开发环境中定义URL路径_Python_Flask - Fatal编程技术网

Python 如何在web开发环境中定义URL路径

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

我正在开发一个应用程序,它有一个课程、章节和课程的层次结构。 一门课程不包含一章&一章包含多节课。所以我已经定义了下面提到的URL,所以如果需要更改,我只想听听你们的建议

/课程

/课程/

/章/

/章//

/教训//


/课程//

如果您想要分级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'
    }]
}