Created
July 3, 2013 21:26
-
-
Save fmasanori/5922968 to your computer and use it in GitHub Desktop.
tutorial bottle 03
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 bottle | |
@bottle.route('/') | |
def home_page(): | |
mythings = ['apple', 'orange', 'banana', 'peach'] | |
return bottle.template('hello_world2', {'username':'Masanori', | |
'things':mythings}) | |
@bottle.post('/favorite_fruit') | |
def favorite_fruit(): | |
fruit = bottle.request.forms.get('fruit') | |
if fruit == None or fruit == '': | |
fruit = 'No Fruit Selected' | |
return bottle.template('fruit_selection', {'fruit':fruit}) | |
bottle.debug(True) | |
bottle.run(host='localhost', port = 8080) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment