#Routing @app.route('/hello/') # example.com/hello/Anthony def hello(name): return 'Hello ' + name + '!' # return s hello Antho ny!
#Allowed Request Methods @app.route('/test') #default. only allows GET requests @app.route('/test', methods=['GET', 'POST']) #allows only GET and POST. @app.route('/test', methods=['PUT']) #allows only PUT
from ask i mport url_for, url_for, redirect
Flask-Mail - http://pythonhosted.org/Flask-Mail/
@app.route('/home') def home(): return rend er_template('home.html')
#import from an exported environment variable with a path to a cong le app.cong.from_envvar('ENV_VAR_NAME')
#Useful Plugins
session['key_name'] = 'key_value' #stores a secure cookie in browser return redire ct(url_for('inde x')) #read session @app.route('/') def index(): if 'key_name' in session: session: #session exists and has key