Deploying Python Apps

A guide to Heroku, Render, and Vercel

Introduction

Deploying Python applications allows you to make your app accessible online. Popular cloud platforms like Heroku, Render, and Vercel simplify the deployment process for web applications built with Flask, Django, or FastAPI.

Each platform has its own workflow, pros, and limitations, which we will explore below.

Deploying on Heroku

Heroku is a cloud Platform-as-a-Service (PaaS) that is beginner-friendly and supports Git-based deployments.

Steps to Deploy:

  1. Install the Heroku CLI.
  2. Login using heroku login.
  3. Create a requirements.txt and Procfile in your project.
  4. Initialize Git and commit your code.
  5. Create a Heroku app: heroku create myapp
  6. Push code to Heroku: git push heroku main
  7. Open your app: heroku open

Heroku is free for small projects but sleeps after inactivity unless upgraded to a paid plan.

Deploying on Render

Render is a modern cloud platform that supports automatic deployments from GitHub and offers free SSL, custom domains, and background workers.

Steps to Deploy:

  1. Sign up on Render.
  2. Create a new Web Service and link your GitHub repository.
  3. Select the branch to deploy and runtime (Python version).
  4. Render automatically installs dependencies from requirements.txt and deploys your app.
  5. Use the provided URL to access your live app.

Render is great for small to medium projects and provides a free tier with persistent apps.

Deploying on Vercel

Vercel is optimized for frontend frameworks but also supports Python serverless functions. It is ideal for deploying APIs or small Flask/FastAPI apps.

Steps to Deploy:

  1. Sign up on Vercel and connect your GitHub repository.
  2. Create a api folder and add Python files as serverless functions.
  3. Push code to GitHub and Vercel automatically deploys your app.
  4. Access your app via the provided Vercel domain.

Vercel is ideal for serverless and lightweight API deployments, with a free tier available.

Comparison of Platforms

Feature Heroku Render Vercel
Best For Web apps, backend APIs Web apps, APIs, background jobs Frontend, serverless Python functions
Deployment Git push GitHub auto-deploy GitHub auto-deploy
Free Tier Yes, sleeps after inactivity Yes, persistent apps Yes, limited serverless functions
Custom Domain Yes Yes Yes
Ease of Use Beginner-friendly Easy, modern UI Simple for serverless apps

References & Learning Links