Deploying Django Apps to Heroku from GitHub

python_tutorials

Introduction

Heroku is a popular Platform-as-a-Service (PaaS) that allows developers to run and deploy applications by availing the infrastructure required in terms of hardware and software.

This means that we do not have to invest in the hardware and software needed to expose our applications to end-users and this freedom allows us to concentrate on our business logic instead of deployment.

In this post, we will outline how to deploy a simple Django application to a Heroku pipeline. It targets existing Python developers and assumes a basic understanding of setting up and running a Django application.

Prerequisites

For this post, we’ll need:

  • A free-tier Heroku account,
  • Python 3+ and Virtualenv installed
  • Git installed and a GitHub account.

Demo Application

Bootstrapping the Django App

Before deploying our Django application, we will need to prepare it as per Heroku’s requirements. We will start by creating a virtual environment, activating it and installing the required packages, and finally bootstrapping a simple Django application:

$ virtualenv --python=python3 env --no-site-packages
$ source env/bin/activate
$ pip install django gunicorn
$ django-admin startproject plaindjango

If everything goes well,

To finish reading, please visit source site