<分区>
@mod.route('/participate/<survey_id>/', defaults = {'work_id':None}, methods = ['GET','POST'])
@mod.route('/pariicipate/<survey_id>/<work_id>', methods = ['GET', 'POST'])
def participate(survey_id, work_id):
/* do_something .. */
我可以访问 http://localhost:5000/participate/512dc365fe8974149091be1f
或 http://localhost:5000/participate/512dc365fe8974149091be1f/
如果我启动调试器,我可以看到 work_id = None
。
如果我尝试 http://localhost:5000/participate/512dc365fe8974149091be1f/512dc365fe8974149091be1f
或 http://localhost:5000/participate/512dc365fe8974149091be1f/512dc365fe8974fe9074
I 404.
为什么会这样?我在路由规则方面做错了什么吗?