未将user_name
传递给other_function
作为参数,我如何才能访问user_name
?
@app.route('/profile/<user_name>/')
def profile(user_name):
other_function()
# do more stuff
def other_function():
print request.args
答案 0 :(得分:1)
您可以通过request.view_args
来访问视图参数,这是一个字典:
def other_function():
print request.view_args['user_name']