Django App Deployment
Steps to Deploy Django
Update the repository
sudo apt update
Install the required packages
sudo apt install nginx
sudo apt install python3-pip
sudo pip3 install gunicorn
sudo apt install certbot
sudo apt install python3-certbot-nginx
Clone your Django project on EC2 instance and install its dependencies:
git clone https://github.com/<username>/<project-name>.git
cd <project-name>
pip3 install -r requirements.txt
Configure Gunicorn to run your Django application:
cd <project-folder>
gunicorn --workers 3 --bind unix:/tmp/gunicorn.sock <project-name>.wsgi:application
Create Nginx server block to proxy requests to Gunicorn:
Last updated
Was this helpful?