python - flask optional url parameter not working -
@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 .. */ i can access http://localhost:5000/participate/512dc365fe8974149091be1f or http://localhost:5000/participate/512dc365fe8974149091be1f/ , if fire debugger can see work_id = none.
if try http://localhost:5000/participate/512dc365fe8974149091be1f/512dc365fe8974149091be1for http://localhost:5000/participate/512dc365fe8974149091be1f/512dc365fe8974149091be1f/ 404.
why happening? there i've done wrong routing rules?
your second route has typo in :)
@mod.route('/pariicipate/<survey_id>/<work_id>', methods = ['get', 'post']) should be
@mod.route('/participate/<survey_id>/<work_id>', methods = ['get', 'post'])
Comments
Post a Comment