Application Setup in Python

From the Flask cheat sheet · Setup & Basics · verified Jul 2026

Application Setup

Create and configure Flask app

python
# Quick Reference
from flask import Flask

app = Flask(__name__)

@app.route('/')
def home():
    return 'Hello World!'

if __name__ == '__main__':
    app.run(debug=True)
💡 Use environment variables for configuration
🔍 Flask(__name__) creates the application instance
⚡ debug=True enables auto-reload and detailed errors
setupconfiguration
Back to the full Flask cheat sheet