Quickstart
This chapter walks you through a minimal but working Flask application, covering development mode and the project entry point.
Installation
Minimal Application
The __name__ passed to Flask(__name__) locates the application root, which is how Flask finds templates/ and static/.
Running the Development Server
--app apppoints at the app object inapp.py(can be omitted when the file is namedapp.pyorwsgi.py)--debugenables the debugger and auto-reload: the server restarts when you save, and errors show an interactive traceback in the browser
Note: the
FLASK_ENV=developmentenvironment variable seen in older tutorials was removed in Flask 2.3 — use the--debugflag instead.
Open http://127.0.0.1:5000 to see the output.
Adding More Routes
Returning JSON and Templates
A Security Note on Debug Mode
The debugger allows executing arbitrary Python from the browser. Never enable --debug or debug=True in production. See the Deployment chapter for production setups.
Next Steps
- Real projects should wrap the application in a factory function (
create_app()) for easier testing and multi-instance creation — see the App Structure chapter. - Continue to the Routing chapter for URL parameters, converters, and
url_for.