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 (1 modified, 0 added, 0 removed)
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.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 +}}}