Created
October 18, 2011 22:27
-
-
Save yosemitebandit/1296926 to your computer and use it in GitHub Desktop.
uppify web demo with flask
This file contains hidden or 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
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! |
This file contains hidden or 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
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() |
This file contains hidden or 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
<!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