Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

flask app example

import flask

# A simple Flask App which takes
# a user's name as input and responds
# with "Hello {name}!"

app = flask.Flask(__name__)

@app.route('/', methods=['GET', 'POST'])
def index():
    message = ''
    if flask.request.method == 'POST':
        message = 'Hello ' + flask.request.form['name-input'] + '!'
    return flask.render_template('index.html', message=message)

if __name__ == '__main__':
    app.run()
Source by flask.palletsprojects.com #
 
PREVIOUS NEXT
Tagged: #flask #app
ADD COMMENT
Topic
Name
1+2 =