flask
Run and manage Flask web applications
TLDR
Run a development server
Show the routes for the app
Run a Python interactive shell in the app's context
SYNOPSIS
flask [OPTIONS] COMMAND [ARGS]...
Examples:
flask run
flask --app hello:app run --debug
PARAMETERS
--app, -a APP
Target Flask application (e.g., module:app, file.py, or factory function). Default: FLASK_APP env.
--debug / --no-debug
Enable/disable debug mode with reloader and profiler.
--load-dotenv / --no-load-dotenv
Load .flaskenv or .env file for environment variables.
--cert CERT
SSL certificate file for HTTPS dev server.
-h, --help
Show help message and exit.
--version
Display Flask version and exit.
DESCRIPTION
The flask command provides a powerful command-line interface (CLI) for the Flask micro web framework in Python. It enables developers to run local development servers, launch interactive Python shells with the app context loaded, list all registered routes, and manage extensions like databases or migrations.
Primarily used during development, it simplifies tasks such as debugging and testing without needing custom scripts. For production, alternatives like Gunicorn or uWSGI are recommended. The CLI uses the Click library under the hood for subcommand handling.
Installation requires Python and pip: pip install flask. It auto-discovers the app via environment variables like FLASK_APP or --app option, supporting formats like module:app, file paths, or factory functions. Debug mode activates the Werkzeug debugger for error inspection. Ideal for rapid prototyping and microservices.
CAVEATS
Not a standard Linux utility; requires pip install flask. Subcommands vary by installed extensions (e.g., Flask-SQLAlchemy adds 'db'). Production use discouraged—use WSGI servers.
CORE SUBCOMMANDS
run: Start development server.
shell: Interactive REPL with app context.
routes: List all URL routes and endpoints.
APP DISCOVERY
Set FLASK_APP env var or use --app. Supports blueprints and factories via create_app().
HISTORY
Flask CLI introduced in Flask 0.11 (January 2016) using Click library, replacing manual scripts. Flask framework created by Armin Ronacher (Pallets Projects) in 2010, inspired by Werkzeug and Jinja2.


