Python: Installing the Flask dependency
This documentation is part of the Building a REST API with Flask guide. You can view the complete guide here: Step-by-step guide to building a REST API with Flask in Python.
👋 Welcome to the Stackhero documentation!
Stackhero offers a ready-to-use Python cloud solution designed to simplify your deployments:
- Deploy your application to production within seconds using a simple
git push.- Use your own domain name, with automatic HTTPS certificate setup for secure connections managed on your behalf.
- Take advantage of automatic backups, one-click updates, and predictable pricing, so you can focus on your code rather than infrastructure management.
- Benefit from high performance and security on a private, dedicated infrastructure. Your environment is isolated and protected.
Save time and streamline your workflow: your code can be up and running with Stackhero's Python cloud hosting in just 5 minutes.
For this example, you need one main dependency: Flask.
Flask is designed to be simple and fast, allowing you to build and deploy web APIs without unnecessary overhead. It provides built-in support for routing, templating, and HTTP request handling, helping you move from idea to working API in just a few minutes.
You can install Flask and python-dotenv using pip:
pip install Flask python-dotenv
We include
python-dotenvto manage environment variables securely and conveniently. You will see how to use it in the following steps.
After installation, freeze your dependencies into a requirements.txt file:
pip freeze > requirements.txt
Freezing dependencies ensures everyone uses the same package versions. This small step can save you hours of troubleshooting later on.