29 lines
670 B
Python
29 lines
670 B
Python
from flask import Flask, flash, redirect, render_template, request, session, abort
|
|
|
|
app = Flask(__name__)
|
|
|
|
@app.route("/")
|
|
def index():
|
|
return "Index!"
|
|
|
|
@app.route("/hello")
|
|
def hello():
|
|
return "Hello World!"
|
|
|
|
@app.route("/form")
|
|
def form():
|
|
return render_template(
|
|
'form.html',**locals())
|
|
|
|
@app.route('/form_post', methods = ['POST'])
|
|
def form_post():
|
|
if request.method == 'POST':
|
|
data = request.form
|
|
print("data: {}".format(data))
|
|
# TODO: save this data to a csv
|
|
# deploy this python app to server somewhere
|
|
# with a particular domain
|
|
return "form submitted"
|
|
|
|
if __name__ == "__main__":
|
|
app.run() |