flaskEasy Examples

Lightweight micro-framework for web apps and APIs with Jinja2 templates

Getting started with flask

Installation and basic usage of flask.

python
# Install: pip install flask
from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello, World!"

@app.route("/user/<name>")
def user(name):
    return f"Hello, {name}!"

if __name__ == "__main__":
    app.run(debug=True)
Expected Output
# Expected output shown below
# (Run locally with: flask)

flask is a third-party package. Lightweight micro-framework for web apps and APIs with Jinja2 templates. Install with: pip install flask

Common flask operations

Frequently used features of flask.

python
# Install: pip install flask
import flask

# Common flask patterns
print(f"flask version: {flask.__version__}")

These are the most commonly used features of flask in everyday development.

Want to try these examples interactively?

Open Easy Playground