LoginSignup
0
0

More than 1 year has passed since last update.

Flaskでincludeしたhtmlをキャッシュさせない方法

Last updated at Posted at 2023-03-24

htmlをincludeした場合にキャッシュが残りファイル更新されない場合の回避方法

以下手順でhtmlの表示が切り替わらかったため回避手順を調べた
1.pythonからtemplatesにhtml出力
2.templates内のhtmlから1のhtmlをinclude
3.1のファイルを更新し2のhtmlを再度表示
4.1で作成したhtmlが表示される(古いhtml)

回避方法

起動時のpyファイルに下記記述を追加する

app.config['TEMPLATES_AUTO_RELOAD'] = True

参考
https://stackoverflow.com/questions/37575089/disable-template-cache-jinja2

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0