Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
from flask import Flask, request
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def home():
text = None
if request.method == 'POST':
if request.form['submit']:
text = "%s" % request.form['submit']
text = request.form['text']
page = """<h1>Flask Test Server</h1>
<form name='main' method='post'>
Enter Text: <input type='text' name='text'>
<input type='submit' value='submit' name='submit'>
if text:
return "%s<h2>%s</h2>" % (page, text)
return page
if __name__ == '__main__':
app.debug = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment