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

Learn More

Basic Flask Example [Python]

1721 Runs 3851 Views 658 Copies
Saved

Saved

sundip 66

sundip
published 4 years ago

    import os
    # Using Flask since Python doesn't have built-in session management
    from flask import Flask, session
    
    app = Flask(__name__)
    
    # Generate a secret random key for the session
    app.secret_key = os.urandom(24)
    
    # Define a route for the webserver
    @app.route('/')
    def index():
      return "Hello world"
    
    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).