Hello,
I am having difficulties to understand the behavior of what I supposed is caching, but I might be wrong.
I have an Iframe calling a html file statically. When I change the content of the html file, and relaunch the server/browser, the iframe is not updated. It only updates if I change the name of the html file and the corresponding path in the call.
Example:
app.py:
import os
import dash
import flask
from flask import request, Flask, send_from_directory
import dash_core_components as dcc
import dash_html_components as html
import dash_table_experiments as dt
from dash.dependencies import Input, Output, State, Event
# Defining the dash/flask app/server
server = flask.Flask(__name__)
app = dash.Dash(sharing=True, server=server, static_folder='static')
@server.route('/static/<path:path>')
def serve_static(path):
root_dir = os.getcwd()
return flask.send_from_directory(os.path.join(root_dir, 'static'), path)
def serve_layout():
return html.Div([
html.Iframe(src='static/video.html',
style={'width':'800px',
'height':'600px',
'margin':'auto',
'display':'block'},
id='video_cont'),
])
app.layout = serve_layout
if __name__ == '__main__':
# To launch in server mode:
server.run(host='0.0.0.0', debug=True)
video.html:
<!DOCTYPE html>
<head>
</head>
<html>
<body>
<video width="100%" height="100%" controls>
<source src="movie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
</html>
if I want to add anything in the test.html, ex:
<!DOCTYPE html>
<head>
</head>
<html>
<body>
<p> test </p>
<video width="100%" height="100%" controls>
<source src="movie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
</html>
then I need to rename the file into, say, video2.html, and to replace
html.Iframe(src='static/video.html',
by
html.Iframe(src='static/video2.html',
in the app.py.
How can I do to have the changes updated directly?
What am I doing wrong here?
Also, really quick question, what’s the convention for style attributes when it is already camel back?
I mean, dashed attributes become camel back (margin-top → marginTop) but what about frameBorder for example? i tried keeping it untouched, but this does not work.
Thanks a lot