godd0t/django-docker-quickstart
Sobre
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.
Desenvolvimento web e de aplicativosO que você pode fazer
- Django web application framework
- PostgreSQL database
- Redis in-memory data structure store
- Celery worker and beat services for running background tasks asynchronously
Crescimento medido de estrelas
- em 24 h
- 0
- em 7 dias
- 0
- em 15 dias
- 0
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalDjango 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
- Python 3.10 or higher
- Make (optional for shortcuts)
Getting Started 🏁
Clone the repository:
git clone https://github.com/godd0t/django-docker-quickstart.gitChange directory into the project:
cd django-docker-quickstartCopy the
env.examplefile to.envand update the values as needed:- For Linux/macOS:
cp env.example .env - For Windows (Command Prompt):
Copy-Item -Path env.example -Destination .env
- For Linux/macOS:
Initial Setup ⚙️
Development Prerequisites
Create a virtual environment:
python -m venv venvActivate the virtual environment:
source venv/bin/activate(Optional) Install the development requirements specific to your IDE for enhanced functionality and support.
pip install -r src/requirements.dev.txtBuild the image and run the container:
If buildkit is not enabled, enable it and build the image:
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f docker-compose.yml up --build -dIf buildkit is enabled, build the image:
docker-compose -f docker-compose.yml up --build -dOr, use the shortcut:
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
Build the image and run the container:
If buildkit is not enabled, enable it and build the image:
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f docker-compose.prod.yml up --build -dIf buildkit is enabled, build the image:
docker-compose -f docker-compose.prod.yml up --build -dOr, use the shortcut:
make build-prod
Shortcuts 🔑
This project includes several shortcuts to streamline the development process:
Create migrations:
make make-migrationsRun migrations:
make migrateRun the linter:
make lintRun the formatter:
make formatRun the tests:
make testCreate a super user:
make super-userBuild and run dev environment:
make build-devBuild and run prod environment:
make build-prod
Explore projetos relacionados
Carregando…