Site icon StudyGyaan

Hosting Your Django Python Website for FREE on Heroku

Django Web Framework Tutorials

Heroku has become a popular choice for developers looking to deploy web applications quickly and easily. If you’re a Django developer seeking a cost-effective hosting solution, you’re in luck! In this blog post, we’ll take you through a detailed step-by-step process of hosting your Django Python website for free on Heroku.


Heroku will no longer offer a free tier

Starting November 28, 2022, Heroku will stop providing a free tier to its users. The company announced this information on August 25, 2022, in this blog post.

READ OUR BLOG on How to Host/Deploy Django Python Website for FREE on Pythonanywhere

PLEASE GO THRU ABOVE BLOG. This is Completely Free and Can deploy your Django Website in just 5 Minutes

Deploy Django Website on Heroku

Step 1: Sign Up and Install Heroku CLI

  1. Create an account on Heroku (
  2. Install Heroku Command Line Interface (CLI) on your local machine.

Step 2: Set Up Your Django Project

  1. Make sure your Django project is version-controlled with Git.
  2. Ensure your project works locally and that the requirements.txt and Procfile are correctly configured.

Step 3: Prepare Your Project

  1. Install Gunicorn (a production-ready WSGI HTTP server) using:
   pip install gunicorn
  1. Create a Procfile (without any file extension) in your project’s root directory and add:
   web: gunicorn your_project_name.wsgi

Step 4: Database Configuration

  1. If you’re using a database, make sure to configure it to work with Heroku. You might consider using Heroku’s PostgreSQL add-on.

Step 5: Commit Changes and Push to Heroku

  1. In your terminal, navigate to your project’s directory.
  2. Run the following commands:
   git add .
   git commit -m "Preparing for Heroku deployment"
   heroku login
  1. Log in to your Heroku account using the browser that pops up.
  2. After logging in, create a new Heroku app:
   heroku create <your-app-name>

Step 6: Deploy Your App

  1. Push your code to Heroku’s remote:
   git push heroku master
  1. Heroku will automatically build and deploy your app.

Step 7: Run Migrations

  1. Run the initial migrations on the Heroku server:
   heroku run python migrate

Step 8: Open Your Deployed App

  1. Once the migration is complete, you can open your app using:
   heroku open

Step 9: Access Logs and Debugging

  1. To view logs, use:
   heroku logs --tail
  1. If any issues arise, these logs will provide helpful information for debugging.


By following these steps, you’ve successfully deployed your Django Python website for free on Heroku. Its simplicity and seamless integration with Django make Heroku a fantastic choice for developers wanting to get their projects up and running quickly without the complexity of traditional hosting solutions. Start showcasing your Django apps to the world with Heroku’s hassle-free deployment process.

Exit mobile version