Changes for page How to serve a HTML file using python flask
Last modified by Leon Poon on 2021/03/23 13:17
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Parent
-
... ... @@ -1,1 +1,1 @@ 1 - Main.WebHome1 +Computing Newbies.Python Newbies.WebHome - 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}}