This is part three of a five-part series on the “Development of a Django web app from testing to production and hosting onto Microsoft Azure’s virtual machine”.
For this series we will focus on:
- Part 1: Developing the Django Web App: Here, we improved the “Restful A.P.I.s in Django Project” we built by building its UI/Web platform as it was only accessible via postman so that users can access the system via web interface with more features. Click here to go through the article.
- Part 2: Acquire a VM from Microsoft Azure: Here, we went through the process of choosing the best VM with regards to cost and performance. Click here to go through the article.
- Part 3: Setting up the VM and uploading of the Project using GIT.
- Part 4: Configuring the Django project on the VM and making it accessible online.
- Part 5: Monitoring of the Django Web App using Microsoft Azure Tools
Intended audience: Who the article is for
This article targets anyone who wants to know where to start using Microsoft Azure’s virtual machines to host their data.
Case Study: What the article is going to cover
This piece aims to give you a basic understanding of how to set up a virtual machine in azure to be accessible from your end for the deployment of your Django project
- Putty – a software used to log into virtual machines, get it here
- A virtual machine in Microsoft Azure, here’s how to get one
Logging into the VM
Log into Microsoft Azure and click on the label “Resource groups”
You will be redirected to the resource group’s page, select the resource group name we just created for our virtual machine.
This will lead you to the specific resource group page, where you will choose the name of the specific virtual machine we created in the previous series article: Part 2
This will lead you to the virtual machine’s page. Where you will be able to get its Public IP address and also make any setting related to the virtual machine.
NB: Remember this virtual machine page as this is where we will configure other virtual machine features
Download and install a software called Putty
Open the Putty Software
Enter the username and Public IP address of the virtual machine we created in the box labelled “Host Name or IP address” e.g. firstname.lastname@example.org
You will receive the pop up below; just click “Yes.”
The terminal will now request you to enter the password to the username; these are the virtual machine username and passwords we created earlier when we acquired a VM from Azure in Part 2.
If successful, the terminal will display brief details regarding the virtual machine and a command-line interface for you to execute commands.
Setting up the VM
We will now upgrade and update the Ubuntu server by typing the: “sudo apt-get update && sudo apt-get upgrade” command on the terminal. Press enter and when prompted for permission to install packages, press “y” for yes
We will now install Python and its related packages that will be used to run the Django application. Type “sudo apt-get install python3-pip && sudo apt-get install python3-venv” command in the terminal.
The virtual machine is now up to date with the latest system and python libraries.
Setting up the python project using GIT
We will now clone the Django repository we created in Part 2 of this series.
- Clone it:
- To know the directory where the repo has been cloned, type the command
- To know the folders located in the current directory, type the command
- ls –l
You should now have a basic understanding of how to set up a virtual machine installing libraries and setting up your Django project via a GIT repository
Please let me know how your experience was, Thank you.