How to Setup Django Server on Azure/AWS/GCP

To setup and install Django server on any of the cloud platforms, the recommended way is to setup a VM using the Django image available from the marketplace. Details below:

Getting Started


Once your Django server has been deployed, the following links explain how to connect to a Linux VM:



Once connected and logged in, you’re ready to start configuring Django

Setting up Django


Once logged in, to check the current version of Django, you can run the following command:


django-admin --version

Create a Django Project


You can create a new Django application using the django-admin command inside the folder of your choice. Change the mysite to a name of your choice:

django-admin startproject mysite

Once the Django project has been created, change the directory to mysite and migrate the changes with the following commands:


cd mysite


python3 migrate

You should get the following output:


Create Django Admin User Account


Next, you will need to create an admin user account for managing the Django project. This will allow you to login to the Django web portal. You can create it with the following command:

python3 createsuperuser

Start Django Application


By default, the Django application can not be accessed from the remote hosts. So you will need to allow Django for external hosts. You can do it by adding your server IP in Run the following command, change the mysite folder directory depending on where you’ve installed Django

sudo nano mysite/

Change the following line:


ALLOWED_HOSTS = [‘your-server-ip’] – Make sure to add the quotations ‘ ‘



Save and close the file. Then, start the Django application with the following command:


Make sure you’re still in your Django root application folder.


python3 runserver


You should see the following output:


Django application has now started and runs on port 8000.


Go to your ServerIP:8000 and you should see the following page:




To use the administrative web admin, Access with /admin


Login with username and password which was setup earlier.




Thats it, you’re now ready to start building your first app.

Django Documentation / Support


Documentation on using Django can be found on the official website:


Get support from the Django community

Django Firewall Ports


By default Django uses the following firewall ports:


TCP 8000

TCP 80

TCP 443


If you are using any of the cloud security groups and need to change / add ports refer to the following guides:


To setup AWS firewall rules refer to – AWS Security Groups

To setup Azure firewall rules refer to – Azure Network Security Groups

To setup Google GCP firewall rules refer to – Creating GCP Firewalls

Disclaimer: Django is a registered trademark owned by Django Software Foundation (DSF) and is licensed under BSD license. No warrantee of any kind, express or implied, is included with this software. Use at your risk, responsibility for damages (if any) to anyone resulting from the use of this software rest entirely with the user. The author is not responsible for any damage that its use could cause.

Avatar for Andrew Fitzgerald
Andrew Fitzgerald

Cloud Solution Architect. Helping customers transform their business to the cloud. 20 years experience working in complex infrastructure environments and a Microsoft Certified Solutions Expert on everything Cloud.

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x