Speed up development with full-stack environments for every branch.

Learn More

for louis [Python and Flask]

Saved

Saved

lewy313 1

lewy313
published 3 months ago

    # We need render template to render our html content
    # and the request object to get the parameters for the
    # current request made by the user
    from flask import Flask, render_template, request
    
    # Initialize the Flask application
    app = Flask(__name__)
    
    # This is a catch all route, to catch any request the user does
    @app.route('/')
    def index():
        # The args property from the request object is
        # a MultiDict with the parsed contents of the query string.
        # So we could get the keys/values, iterate throught them, etc
        # +INFO: http://werkzeug.pocoo.org/docs/datastructures/#werkzeug.datastructures.MultiDict
        params = request.args.getlist("param[]")
        return render_template('index.html', params=params)
    
    if __name__ == '__main__':
        app.run(
            host="0.0.0.0",
            port=int("80")
        )
    Please login/signup to get access to the terminal.

    Your session has timed out.

    Dismiss (the page may not function properly).