Version 1.1 by Leon Poon on 2018/12/24 09:49

Show last authors
1 First, make sure that your flask app is working like inĀ [[How to serve a webpage using python flask>>url:https://wiki.codepowered.com/wiki/How_to_serve_a_webpage_using_python_flask]].
2
3 Then, create your HTML file. Your HTML file must be in the same directory as your flask app python file.
4
5 Change your flask app python file to do send_from_directory instead of just saying hi. Use the name of the HTML file if it is not test.html:
6
7 {{{from flask import Flask, send_from_directory
8
9 app = Flask(__name__)
10
11 @app.route('/', methods=['GET'])
12 def m():
13 return send_from_directory('', 'test.html')
14
15 app.run()
16 }}}