Skip to content

Instantly share code, notes, and snippets.

@NickDeClario
Created May 8, 2016 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save NickDeClario/19abe334bd8104c3e63cb0a74e852afd to your computer and use it in GitHub Desktop.
Save NickDeClario/19abe334bd8104c3e63cb0a74e852afd to your computer and use it in GitHub Desktop.
#!/usr/bin/python
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'>
<p>
Enter Text: <input type='text' name='text'>
<input type='submit' value='submit' name='submit'>
</p>"""
if text:
return "%s<h2>%s</h2>" % (page, text)
return page
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