Adding source code files for Chapter 10

This commit is contained in:
muassif
2021-06-30 12:36:33 +04:00
committed by GitHub
parent 360b7f1420
commit 4d0965b634
19 changed files with 640 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
#app3.py: rendering static and dynamic contents
from flask import Flask, render_template, url_for, redirect
app = Flask(__name__)
@app.route('/hello')
def hello():
hello_url = url_for ('static', filename='app3.html')
return redirect(hello_url)
@app.route('/greeting')
def greeting():
msg = "Hello from Python"
return render_template('app3.html', greeting=msg)
if __name__ == '__main__':
app.run()