Flask url_for生成http URL而不是https [英] Flask url_for generating http URL instead of https
问题描述
<$ c $ 使用 我想明确要求 你能指出我如何改变它吗? 谢谢。 使用Flask 0.10,将会有比包装 I an using However when I changed the page to a https connection, the I would like to explicitly ask Can you point me how to change it? I look at Flask docs, without luck. Thanks. With Flask 0.10, there will be a much better solution available than wrapping
这篇关于Flask url_for生成http URL而不是https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! url_for
来生成重定向网址。但是,当我将页面改为 时, https 连接时, url_for
仍然会给我
url_for
在网址的开始处添加 https 。
url_for
更好的解决方案。如果您查看 https://github.com/mitsuhiko/flask/commit/b5069d07a24a3c3a54fb056aa6f4076a0e7088c7 ,已添加 _scheme
参数。这意味着您可以执行以下操作:
url_for('secure_thingy',_external = True,_scheme ='https',viewarg1 = 1,...)
url_for
to generate redirect url when a user has logged out.return redirect(url_for('.index', _external=True))
url_for
still gives me http.url_for
to add https at the beginning of an url.url_for
. If you look at https://github.com/mitsuhiko/flask/commit/b5069d07a24a3c3a54fb056aa6f4076a0e7088c7, a _scheme
parameter has been added. Which means you can do the following:url_for('secure_thingy', _external=True, _scheme='https', viewarg1=1, ...)