Browse Source

render index.html with no cache control

tags/v1.1.0
liangyongxiong 5 years ago
parent
commit
2b6d4aa48b
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      mindinsight/backend/datavisual/static_resource_api.py

+ 6
- 4
mindinsight/backend/datavisual/static_resource_api.py View File

@@ -17,7 +17,7 @@ import os
import sys

from flask import current_app
from flask import send_from_directory
from flask import make_response
from flask import Blueprint

from mindinsight.conf import settings
@@ -28,10 +28,12 @@ BLUEPRINT = Blueprint("static_resource", __name__, url_prefix=settings.URL_PATH_

@BLUEPRINT.route("/", methods=["GET"])
def index():
"""Interface to return static index.html."""
"""Interface to return index.html."""
app_path = os.path.realpath(os.path.dirname(sys.argv[0]))
index_resource_dir = os.path.realpath(os.path.join(app_path, current_app.static_folder, os.pardir))
return send_from_directory(index_resource_dir, "index.html")
index_html_file = os.path.realpath(os.path.join(app_path, current_app.static_folder, os.pardir, 'index.html'))
with open(index_html_file, 'r') as file_pointer:
html_content = file_pointer.read()
return make_response(html_content)


def init_module(app):


Loading…
Cancel
Save