Created
December 25, 2015 13:39
-
-
Save xiantail/e358505930144b63006c to your computer and use it in GitHub Desktop.
Introducing Python / Chapter 9 Flask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Flask3 Example</title> | |
</head> | |
<body> | |
Say hello to my little friend: {{ thing }}. | |
Alas, in just destroyed {{ place }}! | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template | |
app = Flask(__name__, static_folder='.', static_url_path='') | |
@app.route('/') | |
def home(): | |
return app.send_static_file('index.html') | |
@app.route('/echo/<thing>/<place>') | |
def echo(thing, place): | |
return render_template('flask3.html', thing=thing, place=place) | |
app.run(port=9999, debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment