记录一个url_for的用法

使用url_for生成url时,需要将url协议从http换成https时,就可以通过在函数中增加参数实现:

url_for('secure_thingy',
        _external=True,
        _scheme='https',
        viewarg1=1, ...)

 官档中说了,加_scheme='https'必须加_external=True,否则报ValueError错误。

原文地址:https://www.cnblogs.com/miaoweiye/p/11997600.html