Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/godd0t/django-docker-quickstart
Your all-in-one Django-Docker starter kit. Pre-configured services including PostgreSQL, Redis, Celery, with Nginx and Traefik for production. Streamlined development with included tools for testing and formatting.
https://github.com/godd0t/django-docker-quickstart
coverage django django-docker docker docker-compose nginx pytest traefik
Last synced: about 1 month ago
JSON representation
Your all-in-one Django-Docker starter kit. Pre-configured services including PostgreSQL, Redis, Celery, with Nginx and Traefik for production. Streamlined development with included tools for testing and formatting.
- Host: GitHub
- URL: https://github.com/godd0t/django-docker-quickstart
- Owner: godd0t
- License: mit
- Created: 2023-05-10T07:00:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-11T13:40:48.000Z (7 months ago)
- Last Synced: 2024-04-11T15:08:22.503Z (7 months ago)
- Topics: coverage, django, django-docker, docker, docker-compose, nginx, pytest, traefik
- Language: Python
- Homepage:
- Size: 40 KB
- Stars: 230
- Watchers: 10
- Forks: 31
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- stars - godd0t/django-docker-quickstart - Your all-in-one Django-Docker starter kit. Pre-configured services including PostgreSQL, Redis, Celery, with Nginx and Traefik for production. Streamlined development with included tools for testing a (Python)
- stars - godd0t/django-docker-quickstart - Your all-in-one Django-Docker starter kit. Pre-configured services including PostgreSQL, Redis, Celery, with Nginx and Traefik for production. Streamlined development with included tools for testing a (Python)
README
# Django Docker Quickstart
This quickstart provides an easy way to initiate a Django project using Docker. It comes with pre-configured services including PostgreSQL, Redis, Celery (worker and beat), Nginx, and Traefik, ready to run a Django web application. Additionally, it provides a few handy shortcuts for easier development.
---
## Features 🚀
- **Django** web application framework
- **PostgreSQL** database
- **Redis** in-memory data structure store
- **Celery** worker and beat services for running background tasks asynchronously
- **Nginx** web server for serving static and media files, and proxying requests to the Django application
- **Traefik** reverse proxy for routing requests to the appropriate service and providing SSL termination## Included Packages and Tools 🛠️
- **Pytest**: Testing framework
- **Pytest Sugar**: A pytest plugin for a better look
- **Pytest Django**: A pytest plugin providing useful tools for testing Django applications
- **Coverage**: Test coverage tool
- **Ruff**: Linter
- **Black**: Code formatter## Requirements 📋
- Docker & Docker Compose - [Install and Use Docker](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04)
- Python 3.10 or higher
- Make (optional for shortcuts)---
## Getting Started 🏁
1. **Clone the repository:**
```bash
git clone https://github.com/godd0t/django-docker-quickstart.git
```2. **Change directory into the project:**
```bash
cd django-docker-quickstart
```3. **Copy the `env.example` file to `.env` and update the values as needed:**
- **For Linux/macOS:**
```bash
cp env.example .env
```
- **For Windows (Command Prompt):**
```cmd
Copy-Item -Path env.example -Destination .env
```---
## Initial Setup ⚙️
### Development Prerequisites
1. **Create a virtual environment:**
```bash
python -m venv venv
```2. **Activate the virtual environment:**
```bash
source venv/bin/activate
```3. **(Optional) Install the development requirements specific to your IDE for enhanced functionality and support.**
```bash
pip install -r src/requirements.dev.txt
```4. **Build the image and run the container:**
- If buildkit is not enabled, enable it and build the image:
```bash
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f docker-compose.yml up --build -d
```
- If buildkit is enabled, build the image:
```bash
docker-compose -f docker-compose.yml up --build -d
```
- Or, use the shortcut:
```bash
make build-dev
```You can now access the application at http://localhost:8000. The development environment allows for immediate reflection of code changes.
### Production Setup
1. **Build the image and run the container:**
- If buildkit is not enabled, enable it and build the image:
```bash
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f docker-compose.prod.yml up --build -d
```- If buildkit is enabled, build the image:
```bash
docker-compose -f docker-compose.prod.yml up --build -d
```
- Or, use the shortcut:
```bash
make build-prod
```---
## Shortcuts 🔑
This project includes several shortcuts to streamline the development process:
- **Create migrations:**
```bash
make make-migrations
```- **Run migrations:**
```bash
make migrate
```- **Run the linter:**
```bash
make lint
```- **Run the formatter:**
```bash
make format
```- **Run the tests:**
```bash
make test
```- **Create a super user:**
```bash
make super-user
```- **Build and run dev environment:**
```bash
make build-dev
```- **Build and run prod environment:**
```bash
make build-prod
```
---