2024-04-07 10:24:40 -07:00
|
|
|
|
# Flask
|
|
|
|
|
|
|
2025-04-13 03:57:49 +07:00
|
|
|
|
Flask is a lightweight [WSGI] web application framework. It is designed
|
|
|
|
|
|
to make getting started quick and easy, with the ability to scale up to
|
|
|
|
|
|
complex applications. It began as a simple wrapper around [Werkzeug]
|
|
|
|
|
|
and [Jinja], and has grown into one of the most popular Python web
|
|
|
|
|
|
frameworks in the world.
|
2024-04-07 10:24:40 -07:00
|
|
|
|
|
2025-04-13 03:57:49 +07:00
|
|
|
|
Flask provides a minimal core with no enforced project layout, allowing
|
|
|
|
|
|
developers to choose the tools and libraries they prefer. Its flexibility
|
|
|
|
|
|
makes it an excellent choice for both small projects and enterprise-grade
|
|
|
|
|
|
applications.
|
2024-04-07 10:24:40 -07:00
|
|
|
|
|
2025-04-13 03:57:49 +07:00
|
|
|
|
[WSGI]: https://wsgi.readthedocs.io/
|
|
|
|
|
|
[Werkzeug]: https://werkzeug.palletsprojects.com/
|
|
|
|
|
|
[Jinja]: https://jinja.palletsprojects.com/
|
|
|
|
|
|
|
|
|
|
|
|
## Why Flask?
|
|
|
|
|
|
|
|
|
|
|
|
- Minimal by design – no rigid structure, full freedom of choice.
|
|
|
|
|
|
- Scalable from small scripts to large applications.
|
|
|
|
|
|
- Extensible through a rich ecosystem of extensions.
|
|
|
|
|
|
- Backed by strong documentation and a large, active community.
|
2024-04-07 10:24:40 -07:00
|
|
|
|
|
|
|
|
|
|
## A Simple Example
|
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
|
# save this as app.py
|
|
|
|
|
|
from flask import Flask
|
|
|
|
|
|
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/")
|
|
|
|
|
|
def hello():
|
|
|
|
|
|
return "Hello, World!"
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
$ flask run
|
|
|
|
|
|
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Donate
|
|
|
|
|
|
|
2025-04-13 03:57:49 +07:00
|
|
|
|
The Pallets organization maintains Flask and its ecosystem.
|
|
|
|
|
|
To help grow the community and support long-term development,
|
|
|
|
|
|
[please consider donating today].
|
2024-04-07 10:24:40 -07:00
|
|
|
|
|
2025-04-13 03:57:49 +07:00
|
|
|
|
[please consider donating today]: https://palletsprojects.com/donate
|
2025-01-05 09:02:41 -08:00
|
|
|
|
|
|
|
|
|
|
## Contributing
|
|
|
|
|
|
|
2025-04-13 03:57:49 +07:00
|
|
|
|
Flask welcomes all types of contributions, including:
|
|
|
|
|
|
- Reporting bugs or proposing improvements
|
|
|
|
|
|
- Discussing or suggesting features
|
|
|
|
|
|
- Improving the documentation
|
|
|
|
|
|
- Reviewing or submitting pull requests
|
|
|
|
|
|
|
|
|
|
|
|
To get started, see our [contributing guide][contrib].
|
2025-01-05 09:02:41 -08:00
|
|
|
|
|
2025-04-13 03:57:49 +07:00
|
|
|
|
[contrib]: https://palletsprojects.com/contributing/
|