- Project Description
- Features
- Prerequisites
- Programming Languages
- Getting Started
- Configuration
- License
This repository provides a comprehensive guide and template for deploying a Django application with Docker, Gunicorn, and Nginx. It streamlines the process of containerizing Django applications and setting up a production-ready environment using Docker Compose.
- Django: Utilize Django, a high-level Python web framework, for building robust web applications.
- Nginx (Reverse Proxy): Incorporate Nginx as a reverse proxy server to efficiently handle client requests and distribute them to the appropriate backend servers. Additionally it serves the static files.
- Containerization with Docker: Containerize the Django application and Nginx server using Docker for consistent deployment across different environments.
- Docker: Ensure Docker is installed on your system. You can download it from here
- Python
This project offers separate setups for development and production environments
To run the Django application in a development environment, follow these steps:
-
Clone this repository:
git clone https://github.com/MoigeMatino/Deploying-Django-with-Docker-Gunicorn-Nginx.git
-
Navigate to the project directory:
cd Deploying-Django-with-Docker-Gunicorn-Nginx
-
Update settings:
Configure your Django project settings (e.g., database connection details) in the
config/settings.py
file. -
Build and start the Docker containers using Docker Compose:
docker-compose up
-
Access the Django application at
http://localhost:8000
.
For deploying the Django application in a production environment, follow these steps:
-
Clone this repository:
git clone https://github.com/yourusername/Deploying-Django-with-Docker-Gunicorn-Nginx.git
-
Navigate to the project directory:
cd Deploying-Django-with-Docker-Gunicorn-Nginx
-
Build and start the Docker containers for production using the provided production configuration:
docker-compose -f docker-compose.prod.yaml up -d
This command will build the Docker images (using the specified Compose file) and start the containers in detached mode (-d).
-
Access the Django application through the configured Nginx server at
http://localhost:1337
.
Ensure that your firewall settings allow traffic on port 1337 if you're accessing the server remotely.
- Django Settings: Customize Django settings as per your project requirements. Configuration files are located in the
config
directory. - Nginx Configuration: Modify Nginx configuration if needed. Configuration files can be found in the
nginx
directory.
This project is licensed under the MIT License.