浏览代码

avoid cache static resource after version upgrade

wangweimin 2 年之前
父节点
当前提交
37fa3d0ea8
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      pywebio/platform/page.py
  2. 2 2
      pywebio/platform/tpl/index.html

+ 1 - 1
pywebio/platform/page.py

@@ -49,7 +49,7 @@ def render_page(app, protocol, cdn):
     check_theme(theme)
 
     return _index_page_tpl.generate(title=meta.title, description=meta.description, protocol=protocol,
-                                    script=True, content='', base_url=base_url,
+                                    script=True, content='', base_url=base_url, version=version,
                                     js_file=meta.js_file or [], js_code=meta.js_code, css_style=meta.css_style,
                                     css_file=meta.css_file or [], theme=theme)
 

+ 2 - 2
pywebio/platform/tpl/index.html

@@ -12,7 +12,7 @@
     <link rel="stylesheet" href="{{ base_url }}css/toastify.min.css">
     <link rel="stylesheet" href="{{ base_url }}css/bs-theme/{{ theme }}.min.css">
     <link rel="stylesheet" href="{{ base_url }}css/bootstrap-select.min.css">
-    <link rel="stylesheet" href="{{ base_url }}css/app.css">
+    <link rel="stylesheet" href="{{ base_url }}css/app.css?v={{ version }}">
     {% for css in css_file %}
         {% if css %}<link rel="stylesheet" href="{{ css }}">{% end %}
     {% end %}
@@ -57,7 +57,7 @@
     if (window.navigator.userAgent.indexOf('MSIE ') !== -1 || window.navigator.userAgent.indexOf('Trident/') !== -1)
         $('#output-container').html('<div class="alert alert-danger" role="alert"> Sorry, this website does not support IE browser. ☹ </div>');
 </script>
-<script src="{{ base_url }}js/pywebio.min.js"></script>
+<script src="{{ base_url }}js/pywebio.min.js?v={{ version }}"></script>
 {% for js in js_file %}
     {% if js %}<script src="{{ js }}"></script>{% end %}
 {% end %}