Django comes with a development server that helps run Django projects in localhost. However, to make your web application available worldwide you will need a host machine. Amazon Web Services (AWS) provides EC2 (Elastic Compute Cloud) which is the most popular choice to host Django web applications.
Visit AWS Console first and log in. Now follow simple steps to create an EC2 instance with Ubuntu 18.04
Step 6: Setup Security Group to accept HTTP and HTTPS inbound requests
Run the series of below commands after logging in to your Ubuntu instance:
sudo apt update & sudo apt upgrade sudo apt install python3-pip python3 -m pip install --upgrade pip pip install django==3.2
To verify run:
python3 --version pip --version django-admin --version
Now copy the project from the local machine to the host machine.
scp -i *.pem source_directory.zip ubuntu@public_ip:~/ sudo apt install unzip unzip source_directory.zip
Run the app and keep running it in the background:
screen python3 manage.py runserver 0:8000
Use Ctrl + a + d to detach the screen
Finally, visit public_ip:8000 in your web browser to access your project.