是否可以直接声明flask URL可选参数?
目前,我正在进行以下操作:
@user.route('/<userId>')
@user.route('/<userId>/<username>')
def show(userId, username=None):
pass我怎么能直接说username是可选的呢?
发布于 2015-10-21 17:21:45
@app.route('/', defaults={'path': ''})
@app.route('/< path:path >')
def catch_all(path):
return 'You want path: %s' % pathhttp://flask.pocoo.org/snippets/57/
https://stackoverflow.com/questions/14032066
复制相似问题