
Cloud platform for building Pythonic apps and APIs
The platform for Python that just works
Powerful Ecosystem
Build opinionated MVC web apps with Django, powerful APIs with FastAPI, or process background jobs with Celery. Run your apps with Gunicorn, Uvicorn, or any other ASGI/WSGI server – the choice is yours!
Fast Deploys
Deploy from Git, your CI system, or on every push to a branch on GitHub. Dependency installs are always consistent with your local environment thanks to transparent support for pip freeze.
Easy Scaling
Heroku’s stateless architecture is ideal for horizontal scaling of services. Issue a command or drag a slider to add capacity. Using larger dynos? Gunicorn will auto-adjust the number of worker processes it spawns.
Get started now with Python on Heroku
Deploying Python apps with Heroku
uv init
initializes the Python project and Git repository- Add Flask as a project dependency
- Update
main.py
to respond to requests with “Hello Heroku!” - Create a
Procfile
to declare the web process - Create and deploy the app to Heroku
- We’re live!
curl https://stormy-escarpment-95361-6c245e7b263a.herokuapp.com
Heroku gives you simple, easy ways to…
Be in the Flow
Collaborating easily, testing early, and deploying often are all part of Heroku Flow: Heroku Pipelines streamline your workflow, Heroku Review Apps auto-deploy your PRs, Heroku CI tests anything you push to GitHub, and much more.
Architect and scale
The Heroku runtime makes it easy to deploy loosely coupled services that run in lightweight, isolated Linux containers known as dynos. The architecture of the Heroku platform encourages best practices that ensure durability and scalability.
Extend and grow
Extend your app with relational databases like PostgreSQL or MySQL, leverage NoSQL data stores such as Redis® or MongoDB, stream events into Apache Kafka or an AMQP server, send emails, monitor your app – with 200+ add-ons, the possibilities are limitless.
Python on Heroku
“As the Zen of Python says, ‘Simple is better than complex’, and that’s what it’s like deploying Python applications to Heroku.”

Heroku Python Support FAQ
How does Heroku manage Python dependencies?
Heroku manages Python dependencies using either pip, Pipenv, Poetry, or uv. When you deploy, the buildpack looks for a requirements.txt
, Pipfile.lock
, poetry.lock
or uv.lock
file to determine which package manager to use. The buildpack then installs the exact packages and versions your application needs, creating a predictable and reliable environment.
If you don’t have a preference, Heroku recommends managing your Python dependencies with uv. You can get started with uv by following this uv blog post.
What is the fastest way to deploy a sample Python application to Heroku?
The fastest way to get started is by following the official Getting Started on Heroku with Python guide in the Heroku Dev Center. This tutorial provides a sample application and walks you through the steps of setting up a virtual environment, managing dependencies, and deploying your code with a simple git push heroku main
command.
Which Python versions are supported on Heroku?
Heroku’s Python support policy is aligned with the official Python Version Lifecycle. All modern, stable versions of Python are supported, but versions are deprecated as they approach upstream end-of-life (EOL), and support for them is removed from the Python buildpack shortly after EOL occurs.
You can specify the exact version your app requires by creating a .python-version
file in the root of your project.
What are the most popular Python frameworks to deploy on Heroku?
Heroku supports the entire Python web ecosystem. It offers robust support for major frameworks like Django and Flask. Additionally, modern ASGI frameworks like FastAPI are excellent choices for building high-performance APIs on Heroku.
What is a Procfile, and is it required for Python apps?
A Procfile is a simple text file, named Procfile
without a file extension, that you place in your project’s root directory to explicitly declare what commands Heroku should run for your application. It allows you to define one or more process types, such as a web process for your web server or a worker process for a background job.
For a typical Django or Flask application using the Gunicorn server, a Procfile would look like this:
web: gunicorn your_project.wsgi
How should I handle static assets (like CSS and JavaScript) in a Django application on Heroku?
Django does not support serving static files directly in a production environment; a dedicated solution is required. The recommended and most common solution on Heroku is to use the WhiteNoise library.
WhiteNoise allows your web application to serve its own static files efficiently in production. During deployment, Heroku’s Python buildpack automatically runs the collectstatic
command to gather all your static assets, and WhiteNoise handles the rest. This is the simplest and most reliable method for managing Django static files on Heroku.
Can I run a Python shell or a management command on my running Heroku app?
Yes, you can. This is a common and powerful feature of the Heroku platform, handled by the Heroku CLI. Using the heroku run
command, you can start a new instance of your application’s environment (called a one-off dyno) to execute commands. For example, you can open an interactive Python shell with heroku run python
or run a Django database migration with heroku run python manage.py migrate
. This is extremely useful for debugging, running administrative tasks, and managing your database.
You can also get a plain interactive shell by running heroku run bash
that will allow you to inspect the contents of your application using common terminal commands such as cat
and ls -la
.
Can I deploy data science and machine learning models with Python on Heroku?
Yes. You can deploy Python applications that handle a wide range of data science tasks on Heroku dynos. This includes everything from data manipulation and analysis using libraries like Pandas and NumPy, to deploying machine learning models built with Scikit-learn and Statsmodels as web APIs.
And for more demanding or production-grade machine learning, Heroku offers dedicated services. Heroku Managed Inference and Agents is specifically designed for deploying and scaling complex models and AI agents with high availability. For large-scale or private compute needs, MCP on Heroku provides a secure and powerful environment.
This provides a flexible pathway for your projects. You can begin with standard dynos—a great option for smaller models and prototypes—and then scale up to these dedicated services for serious ML workloads.
Ready to Get Started?
Stay focused on building great data-driven applications and let Heroku tackle the rest.