Today we are going to deploy our Django project in AWS. Our Django project’s code are stored in the GitHub repository, and we have an EC2 instance created and running with ubuntu 18.04 LTS operating system in AWS. We are going to see the steps to deploy our Django project from GitHub to AWS EC2 instance.
Before going to the steps and setting up our server, we have a checklist, go through it and make sure it’s done before going through the steps.
Django Project
You must have a Django project which is completed or it runs without any error, and the Django project must stored inside the django_deployment directory.
GitHub repository
After having the Django project you must push all the codes into the GitHub repository.
AWS (Amazon Web Services)
You will need a free or paid AWS account with an EC2 instance created and running with ubuntu 18.04 LTS and also it should accept all the public request from http and https method.
<aside> ⚠️ Note: For my convenience I am renaming EC2 instance to cloud computer. From now on whenever their is cloud computer it means EC2 instance.
</aside>
Till now we have created our cloud computer and it’s running ubuntu 18.04 LST operating system. Now our task is to download and configure the software package to run our Django project. To run our Django application we need:
So let’s install all the required software dependencies for our project. Before doing so we are going to update our system for the latest software packages.
Run these two commands to update and upgrade all the software packages installed in the system.
apt-get update
apt-get upgrade
By using these two commands we have completed our system update.
Now we are going to install all the software packages we need for our Django project.
apt-get install -y python3-dev python3-venv sqlite python-pip git
By using the above command we have installed the required software packages.
At this point we have done our cloud computer setup.
Next we are going to setup our Django project in the cloud computer.
We are going to save all of our work in the /usr/local/workspace directory. So from now on whenever I use WORKSPACE directory it means /usr/local/workspace directory.