About Flask
Flask is a BSD-licensed WSGI framework that began as a thin layer over Werkzeug and Jinja. A single file with one route is a working app, while blueprints, a Click-based CLI and a large extension ecosystem carry it to bigger projects without imposing a structure.
Python web apps run well on a modest Cloud VPS, and DDR5 memory leaves room for several Gunicorn workers. With root access you choose the Python version, WSGI server and proxy, and hourly billing suits short-lived test servers.
You start from Ubuntu 24.04 LTS, Python and Flask, with nothing else in the way of your code.
What you get with Flask
- Routing and request handling from Werkzeug
- Jinja templates with autoescaping
- Blueprints to split large apps into modules
- A
flaskcommand line built on Click - Extensions for databases, auth, forms and more
Flask use cases
- Small web apps and admin tools
- JSON APIs and webhook endpoints
- Prototypes that may grow into products
After you deploy Flask
- With the server Running, connect over SSH as root and make a virtual environment for your project.
- Try it with
flask --app app run --host 0.0.0.0and openhttp://<server IP>:5000; the built-in server is for development only. - For production, install Gunicorn and run
gunicorn -w 4 'app:app'under a systemd unit. - Put Nginx in front with your domain and HTTPS, proxying to Gunicorn on port 8000.
Flask ports
Open these in your firewall if you use one: 80/tcp HTTP, 443/tcp HTTPS, 5000/tcp dev server.
Flask FAQ
Can I use the Flask development server in production?
No. Flask's documentation says it is not designed for production. Use a WSGI server such as Gunicorn, Waitress or uWSGI behind Nginx, and keep port 5000 closed to the internet.
Does Flask support async views?
Yes, async def views work after installing the flask[async] extra, but Flask remains a WSGI framework. For mostly asynchronous workloads, an ASGI framework such as FastAPI may fit better.
Disclaimer. The Flask project has no affiliation with CloudSat and does not endorse it. Names and logos belong to their owners and appear only to identify the software.