Created
October 9, 2013 08:46
-
-
Save drakeguan/6898232 to your computer and use it in GitHub Desktop.
Hello world in Flask
This file contains 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
#!/usr/bin/env python | |
from flask import Flask | |
from flask import request | |
from flask import render_template | |
app = Flask(__name__) | |
@app.route('/hello') | |
def hello_world(): | |
return 'Hello World!' | |
@app.route('/', methods=['GET', 'POST']) | |
def index(): | |
if request.method == 'POST': | |
f = request.files['upfile'] | |
f.save('/tmp/ooxx.save') | |
return 'done' | |
return render_template('index.html') | |
if __name__ == '__main__': | |
app.debug = True | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment