Last modified by Leon Poon on 2021/03/23 13:17

From version 2.1
edited by Leon Poon
on 2018/12/24 13:03
Change comment: There is no comment for this version
To version 1.1
edited by Leon Poon
on 2018/12/24 09:49
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,11 +1,10 @@
1 -First, make sure that your flask app is working like in [[How to serve a webpage using python flask>>doc:Main.How to serve a webpage using python flask.WebHome]].
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 2  
3 3  Then, create your HTML file. Your HTML file must be in the same directory as your flask app python file.
4 4  
5 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 6  
7 -{{code language="python"}}
8 -from flask import Flask, send_from_directory
7 +{{{from flask import Flask, send_from_directory
9 9  
10 10  app = Flask(__name__)
11 11  
... ... @@ -14,4 +14,4 @@
14 14   return send_from_directory('', 'test.html')
15 15  
16 16  app.run()
17 -{{/code}}
16 +}}}