How to Deploy Django Application from GitHub Repository to EC2 With SSL

by Published: Last updated: August 3rd, 2020

Deploying applications on AWS EC2 can be a real pain for those who do it for the first time.

Let's see how we can easily deploy a Django application on AWS with Appliku.

Table of Contents

1. Requirements
2. Repository in GitHub
3. AWS Account
4. Appliku Account
5. Create a Server
6. Create an application
7. Deploy the application
8. The Django application is running AWS EC2 instance

1. Requirements

- Repository in GitHub
- AWS account
- Appliku account

2. Repository in GitHub

If you don't have your own app, you can fork or clone appliku_start.

Your repository must have a Procfile. An example can be found here:

3. AWS Account

If you don't already have an AWS account, then you should sign up for here:

Then go here to create a user that Appliku will use to perform server setup:

Fill a username of your liking.

Check "Programmatic Access".

And click the button "Next: Permissions"

On the next page switch to the tab "Attach Existing Policies Directly".

Add the following policies:


Then click the "next" button.

Click the "Next" button, we don't need to add any tags.


Click the "Create user" button.

Click the "Download .csv" button to save credentials. You can click the "Show" label so display your Secret Access Key.

You can copy and paste keys into the Appliku account.

It is important to keep these keys safe!

4. Create Appliku Account

If you don't already have an Appliku account create it by going here:

During the on-boarding process or in settings specify your AWS credentials.

Go to the settings page:

Copy and paste your Access key ID and secret access key and click "Test and Save Credentials".


5. Create a server

Now when we finished preparations let's create a server.

In Appliku Dashboard go to Servers tab:

Click on the "Create New Server" button.

Select AWS as a cloud provider.

On the next page, we need to choose a region and server size.

Closest to me is "eu-central-1", you can pick what is closer to you or your app's users.

We'll choose server size t2.micro as it is eligible for the free tier, AWS gives to new users.

Please note, that since AWS doesn't provide prices for servers in their API – we can't know how much will it cost. Consult the AWS site for prices.


Click the "Create Instance" button.

You will be redirected to the server overview page.


The server is being created by AWS and Appliku is waiting for the process to be finished.

When the server is ready, server details will appear on this page.

The page will look similar to this.

Please note the "Setup" row. As soon as the server is available, Appliku will start the installation and configuration of the required software.

When it says "finished" – server is ready to deploy applications.

6. Create an application

Finally, we can create an app!

On the "Applications" tab click the "New App from GitHub" button and or click this link:

Come up with a name for your app, it must be unique across all applications in Appliku.

Choose a repository, branch, and pick a server to deploy to.

To create databases and check the "Provision Default Databases and Config Vars" box.

Click the "Create Application" button.

The application will be created, and you will be brought to the Application Dashboard.

It will look like this:

Please note, that that application is not deployed yet.

First, let's go to the "Processes" tab.

Processes are populated from the Procfile in your repository.

Turn on the "web" worker.

This change is saved automatically and will be applied during the deployment. Please note, that unless you hit deploy, this will not affect currently running processes.

Let's explore

Now go to the application "Settings" tab.

In the "Config Variables" section click "Reveal Config Vars".

You will see that Appliku added automatically DJANGO_ALLOWED_HOSTS, generated DJANGO_SECRET_KEY, and database variables.

You can add variables that are required for your app.


Let's return to the application "Overview" page.

7. Deploy the application

Everything is ready to deploy, so click the "Deploy Now" button.


It should change to this, showing the status of the current deployment.


While it is building let's click "Manage Deployments". You will see the deployment settings form and list of the deployments.

You should see only one deployment in history. Click on "View logs" to see what is going on.

As you can see packages are being installed for you.

When the deployment is finished click on the "Open App" tab.

8. The Django application is running AWS EC2 instance

If you used the "appliku_start" repository, the main page of the app should look like this:

Congrats on the deployment of the Django App to AWS!

You can see that the application is accessible via HTTPS.

Appliku automatically generates an SSL certificate issued by Let's Encrypt.

The certificate renewal is also automatic so that you don't need to worry about it.


Recent posts

Background tasks with Celery without pain

Highly opinionated practical guide to using Celery for Python/Django background tasks