python - How to open html containing framset using flask framework -
i want open index.html,
but can not find pic.html
how do
pic.html , index.html in templates
index.html
<body> <iframe src="pic.html"></iframe> </body> flaskdemo.py
from flask import flask,render_template app = flask(__name__) @app.route('/') def hello_world(): return render_template("index.html") if __name__ == '__main__': app.run()
flask doesn't serve files templates directory. need set route /pic.html , render appropriate template part of that:
from flask import flask,render_template app = flask(__name__) @app.route('/') def hello_world(): return render_template("index.html") @app.route('/pic.html') def pic(): return render_template("pic.html") if __name__ == '__main__': app.run()
Comments
Post a Comment