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

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

Summary

Details

Page properties
Content
... ... @@ -1,10 +1,11 @@
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]].
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]].
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 -{{{from flask import Flask, send_from_directory
7 +{{code language="python"}}
8 +from flask import Flask, send_from_directory
8 8  
9 9  app = Flask(__name__)
10 10  
... ... @@ -13,4 +13,4 @@
13 13   return send_from_directory('', 'test.html')
14 14  
15 15  app.run()
16 -}}}
17 +{{/code}}