Quantcast
Channel: 一言多いプログラマーの独り言
Viewing all articles
Browse latest Browse all 846

Python+Flaskで、URLを生成する「url_for()」

$
0
0
Python+Flaskで、URLを生成する「url_for()」です。

url_for([関数名], [パラメーター部分])

という具合に使えます。


<a href="{{ url_for('index') }}">ホーム</a>

<a href="{{ url_for('hello', name='太郎') }}">こんにちは</a>

実際に設定してみたのがこちら

参考サイト
Quickstart(Flask Documentation)

Viewing all articles
Browse latest Browse all 846

Trending Articles