Before you begin this tutorial, you'll need the following:
The VM instance can be created by following the below steps:
Click on the Navigation Menu
Click on Compute Engine and Enable it if you are using it for the first time
Click on Create Instance
Enter the Name of the Instance
Choose the Region and Zone
Choose the Machine Type
Choose the Boot Disk
Choose the Firewall
Click on Create
Click on SSH on the VM instance to connect to the machine that you created just now.
Update the System and install pip3
sudo apt update
sudo apt install python3-pip
Install Django with the help of pip3
sudo pip3 install django
Also, Install the necessary Python libraries that may be required for your Django Project. To install those packages use the syntax below
sudo pip3 install [your package name]
Use the git clone method to clone your project.
git clone "your repository https link"
Go to the directory of the Django project where you can find the manage.py and make it executable
chmod +x manage.py
Now go to the directory of the project where you have settings.py file and edit the settings.py file as shown below:
nano settings.py
Now again go to the manage.py file directory and run the following command:
sudo python3 manage.py runserver 0.0.0.0:80
Now you can open the following URL:
http://YOUR_EXTERNAL_IP
This is how you can Host your Django Application on Google Cloud Platform.