假设我有以下结构:
/root/user/login
我在蓝图中登录:
app.register_blueprint(login_blueprint,url_prefix=prefix('/user'))
我可以重定向到“.index”:
@login_blueprint.route('/login', methods=['GET', 'POST'])
def login():
if request.method == 'POST':
#### this redirects me to '/root/user/'
redirect_to_index= redirect(url_for('.index'))
response = current_app.make_response(redirect_to_index)
# do the log in
return response
redirect_to_index=redirect(url_for('.index'))
response = current_app.make_response(redirect_to_index)
重定向将我带到/root/user
:
redirect(url_for('.index'))
但是如何到达/root
(相对于当前 url ( ..
) 而言呢?