Skip to content

Instantly share code, notes, and snippets.

@yosemitebandit
Created October 18, 2011 22:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yosemitebandit/1296926 to your computer and use it in GitHub Desktop.
Save yosemitebandit/1296926 to your computer and use it in GitHub Desktop.
uppify web demo with flask
This little 'app' responds in uppercase with whatever url path you specify.
It's the Flask-based alternative of the Django example written up here: http://gun.io/blog/python-for-the-web/
to make it work, create this directory structure:
uppify/
| - serve.py
| - templates/
| - uppify.html
then run
$ pip install flask
$ cd uppify/
$ python serve.py
* Running on http://127.0.0.1:5000/
to test, visit http://127.0.0.1:5000/howdy!
import flask
app = flask.Flask(__name__)
@app.route('/<incoming>')
def uppify(incoming):
return flask.render_template('uppify.html', message=incoming.upper())
if __name__ == '__main__':
app.run()
<!doctype html>
<html>
<body>
{{ message }}
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment