Flask interview question · Most asked

What is Flask and what does 'microframework' mean?

Summary

Flask is a lightweight WSGI web framework for Python built on Werkzeug (HTTP/WSGI toolkit) and Jinja2 (templating). 'Micro' means the core stays small and unopinionated, with features like ORM, forms and auth added via extensions.

Longer Answer

Flask gives you routing, request/response objects, sessions, templating, a CLI and a test client. It doesn't choose a database layer, validation library or project structure for you. That flexibility suits APIs, small services and teams that want control, but larger apps need deliberate conventions (blueprints, app factory, extensions).

Code Example

from flask import Flask, jsonify

app = Flask(__name__)

@app.get("/health")
def health():
    return jsonify(status="ok")

# flask --app app run --debug

Key Points

  • Built on Werkzeug + Jinja2 (+ Click, ItsDangerous)
  • Small core, extensible via extensions
  • No built-in ORM or form validation
  • WSGI-based; async views supported with limits

Comparison / Tradeoffs

Flask Django FastAPI
Philosophy Micro, choose your stack Batteries included API-first, type hints
Interface WSGI WSGI/ASGI ASGI
ORM Bring your own (SQLAlchemy) Django ORM Bring your own

More most-asked Flask questions

← All Flask questions