- Key Features
- Quick Start
- Development Guide
- Useful Commands
- Environment Setup
- Security Features
- Project Structure
- Recommended Packages
- Todo & Roadmap
- π Django 5+ with full feature set
- π οΈ Django Rest Framework for API development
- π API documentation (drf-spectacular + Swagger)
- πΏ PostgreSQL database
- π¦ Redis caching
- β³ Celery task management
- π§ͺ Pytest testing suite with code Coverage
- β‘ Jupyter Notebooks integration
- π Django Debug Toolbar
- π§ Code quality tools (Black, Flake8)
- π¨βπ» VS Code with Dev Containers
- π Knox authentication system
- π½ Advanced filtering capabilities
- π» VS Code
- π Docker
- π³ Docker Compose
- Use GitHub's template feature (recommended) or clone repository
- Open in VS Code
- Check
Todo Tree
in the sidebar for setup guidance - Run
CTL/CMD + Shift + p
and selectReopen in container
- Create superuser:
python manage.py createsuperuser
- Start server:
python manage.py runserver
The template uses Knox for token-based authentication:
POST /auth/create/
- Create a new userPOST /auth/login/
- Log in and receive tokenPOST /auth/logout/
- Invalidate current tokenPOST /auth/logoutall/
- Invalidate all tokensGET/PUT/PATCH /auth/profile/
- Manage user profile
- Login attempts: 5 per minute
- User operations: 1000 per day
- Anonymous operations: 100 per day
- Swagger UI available at
/api/schema/swagger-ui/
- Automatic schema generation with drf-spectacular
- Includes example requests and responses
- Documents authentication requirements
- Tests are organized by app in
tests/
directories - Uses pytest fixtures for common testing scenarios
- Includes comprehensive test coverage for authentication
- Includes examples of API endpoint testing
The template includes a base task class with retry capabilities. You can use it to create tasks that automatically retry on failure.
from apps.core.tasks import BaseTaskWithRetry
@shared_task(base=BaseTaskWithRetry)
def my_task():
# Will retry 3 times with exponential backoff
pass
Scheduled tasks are managed with Celery Beat. You can define your periodic tasks in the tasks.py
file of your app and configure them from the Django admin interface.
from apps.core.tasks import BaseTask
@shared_task(base=BaseTask)
def my_periodic_task():
# This task can be scheduled to run at regular intervals
# from the Django admin interface
pass
This section provides a list of useful commands to help you manage and develop your Django project efficiently.
poetry run worker
: to start a new Celery worker.poetry run beat
: to start your periodic tasks.
pytest
to run the tests.pytest --cov
to run the tests with coverage.pytest --cov --cov-report=html
to run the tests with coverage and generate a HTML report.
poetry run server
instead ofpython manage.py runserver
poetry run makemigrations
instead ofpython manage.py makemigrations
poetry run migrate
instead ofpython manage.py migrate
poetry run create_dev_env
to create a development.env
filepoetry run seed
to seed your database with sample data
The template includes a powerful seeding command to populate your database with sample data for development and testing:
# Basic seeding with default options (creates 10 users)
python manage.py seed
# Create specific number of users
python manage.py seed --users 20
# Create a superuser (admin@admin.com:admin)
python manage.py seed --superuser
# Clean existing data before seeding
python manage.py seed --clean
# Combine options
python manage.py seed --users 50 --superuser --clean
- Development:
.env
file created automatically - Production: See
.env.example
for required variables
- Email-based authentication
- Token-based authorization
- Rate limiting and throttling
- CORS configuration
- Debug mode control
- Secure password hashing
βββ .devcontainer/ # Dev container config
β
βββ .github/ # GitHub CI/CD workflows
β
βββ .vscode/ # VS Code settings
β
βββ apps/
β βββ core/ # Core functionality
β β βββ management/ # Custom management commands
β β βββ tests/ # Core app tests
β β βββ schema.py # API schema definitions
β β βββ tasks.py # Celery base tasks
β β
β βββ users/ # User Management and Authentication app
β βββ tests/ # User app tests
β βββ managers.py # User model managers
β βββ models.py # User model definition
β βββ schema.py # User API schemas
β βββ throttles.py # Rate limiting
β βββ views.py # User API views for authentication
β
βββ conf/ # Project configuration
β βββ settings.py # Main settings file
β βββ test_settings.py # Test-specific settings
β βββ celery.py # Celery configuration
β
βββ logs/ # Application Info and Error logs
β
βββ scripts/ # Utility scripts
β
βββ .env.example # Example environment variables
βββ .flake8 # Flake8 configuration
βββ .gitignore # Git ignore file
βββ manage.py # Django management script
βββ notebook.ipynb # Jupyter Notebook
βββ pyproject.toml # Project dependencies
βββ pytest.ini # Testing configuration
- django-axes Keep track of failed login attempts in Django-powered sites
- django-softdelete Soft delete for Django ORM
- django-simple-history Store model history and view/revert changes from admin site
- Index Page with a link to the Django admin
- OpenAPI 3 schema generation and Swagger
- CI with Github Actions
- Data seeding
- Production Docker file
- Production Docker compose file
- CD with Github Actions