Skip to content

Instantly share code, notes, and snippets.

@xiantail
Created December 25, 2015 13:16
Show Gist options
  • Save xiantail/75558469c736df8b199b to your computer and use it in GitHub Desktop.
Save xiantail/75558469c736df8b199b to your computer and use it in GitHub Desktop.
Introducing Python / Chapter 9 - Flask
<html>
<head>
<title>Flask2 Example</title>
</head>
<body>
Say hello to my little friend: {{ thing }}
</body>
</html>
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>')
def echo(thing):
return render_template('flask2.html', thing=thing)
app.run(port=9999, debug=True)
@xiantail
Copy link
Author

flask2.html should be placed under template/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment