A production-ready Django skeleton project that serves as a solid starting point for building modern web applications.
Shirobase is a production-ready Django skeleton project designed to jumpstart your development process. Instead of spending hours setting up the same boilerplate configurations for every new project, use Shirobase as your foundation.
What's Included:
- Complete authentication system with JWT tokens and REST APIs
- Two pre-built Django apps (users and accounts)
- API documentation with Swagger/ReDoc
- Docker containerization
- Testing framework with pytest
- Code quality tools (Ruff linter)
- Comprehensive middleware and security configurations
- Development tools (debug toolbar, auto-reload)
- Production-ready settings (WhiteNoise, logging, PostgreSQL support)
This skeleton comes with 20+ essential packages and best practices already integrated, allowing you to focus on building your application's unique features from day one.
- Python 3.14 - Latest Python version
- Django 5.2 - Modern Django framework
- uv - Fast Python package manager
- Django REST Framework - RESTful API toolkit
- PostgreSQL/SQLite - Database support
- Docker - Containerization support
This skeleton project includes:
- โ Pre-configured Django 5.2 setup
- โ Modern Python 3.14 support
- โ UV package management for lightning-fast dependency resolution
- โ Docker configuration for containerized deployment
- โ Clean project structure with organized apps
- โ Custom User model with Profile support
- โ Django Allauth integration for complete authentication flows
- โ DJ-REST-Auth for RESTful API authentication endpoints
- โ JWT authentication with SimpleJWT (access & refresh tokens)
- โ Token blacklisting support
- โ Custom permissions system (Smartmin)
- โ Django Author for automatic created_by/modified_by tracking
- โ Django REST Framework fully configured
- โ drf-spectacular for automatic OpenAPI/Swagger documentation
- โ Django Filter for advanced filtering
- โ Custom CSRF middleware with API exemptions
- โ Pagination enabled by default
- โ PostgreSQL support (with psycopg)
- โ SQLite support for development
- โ Django Extensions with TimeStampedModel
- โ Phone number field support
- โ Audit logging with django-auditlog
- โ Pytest configuration with Django integration
- โ pytest-sugar for enhanced test output
- โ pytest-xdist for parallel test execution
- โ Ruff for fast Python linting and formatting
- โ Comprehensive test structure
- โ Django Debug Toolbar (in DEBUG mode)
- โ Django Browser Reload for auto-refresh
- โ Django Extensions with management commands
- โ Loguru for advanced logging
- โ Environment variable management (django-environ, python-dotenv)
- โ WhiteNoise for static file serving
- โ Security middleware configured
- โ CSRF protection with trusted origins
- โ Login required middleware
- โ Ready for production deployment
- Python 3.14 or higher
- uv package manager
For those who want to get running immediately:
# Clone and setup
git clone <repository-url> myproject && cd myproject
# Install dependencies
uv sync
# Setup database
uv run python manage.py migrate
# Create admin user
uv run python manage.py createsuperuser
# Run server
uv run python manage.py runserverVisit http://localhost:8000 - you're ready to build! ๐
# Clone the repository
git clone <repository-url> your-project-name
cd your-project-name# Using uv (recommended)
uv syncCreate a .env file in the project root with your configuration:
# Security
SECRET_KEY=your-secret-key-here
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
# Database (SQLite - default for development)
USE_SQLITE=True
# Database (PostgreSQL - for production)
# USE_SQLITE=False
# DB_NAME=your_database_name
# DB_USER=your_database_user
# DB_PASSWORD=your_database_password
# DB_HOST=localhost
# DB_PORT=5432uv run python manage.py migrateuv run python manage.py createsuperuseruv run python manage.py runserverVisit http://localhost:8000 to see your application running.
Once the server is running, visit:
- Docs:
http://localhost:8000/api/docs/ - Swagger UI:
http://localhost:8000/api/schema/swagger-ui/ - ReDoc:
http://localhost:8000/api/schema/redoc/ - OpenAPI Schema:
http://localhost:8000/api/schema/
Use your superuser credentials to access the admin panel:
- Admin Panel:
http://localhost:8000/admin/
- Custom User model extending Django's AbstractUser
- User Profile model with phone number field
- Automatic timestamp tracking (created/modified)
- Author tracking (who created/modified)
- Complete REST API for authentication:
POST /api/accounts/login/- User login (returns JWT tokens)POST /api/accounts/logout/- User logoutPOST /api/accounts/registration/- User registrationGET/PUT /api/accounts/user/- Get/update user detailsPOST /api/accounts/password/change/- Change passwordPOST /api/accounts/password/reset/- Request password resetPOST /api/accounts/password/reset/confirm/<uid>/<token>/- Confirm password reset
Build and run the application using Docker:
# Build the Docker image
docker build -t shirobase:latest .
# Run the container
docker run -p 8000:8000 --env-file .env shirobase:latest
# Run in detached mode
docker run -d -p 8000:8000 --env-file .env shirobase:latest
# Access running container
docker exec -it <container_id> shBefore deploying to production:
# Set DEBUG=False in your .env file
DEBUG=False
# Collect static files
uv run python manage.py collectstatic --noinput
# Run migrations
uv run python manage.py migrate
# Create cache table (if using database cache)
uv run python manage.py createcachetable
# Check for common issues
uv run python manage.py check --deploy# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov
# Run specific test file
uv run pytest path/to/test_file.py
# Run specific test Test Class
uv run pytest path/to/test_file.py::DummyTestClass
# Run specific test function
uv run pytest path/to/test_file.py::DummyTestClass::dummy_test_successful
# Run tests in parallel
uv run pytest -n autoThe project uses Ruff for fast linting and formatting:
# Check code for issues
uv run ruff check .
# Auto-fix issues
uv run ruff check --fix .
# Format code
uv run ruff format .When DEBUG=True, the following tools are available:
- Debug Toolbar: Visible on all pages, provides insights into queries, templates, cache, etc.
- Browser Reload: Automatically refreshes the browser when code changes are detected
Django Extensions provides additional helpful commands:
# Show all URLs in the project
uv run python manage.py show_urls
# Generate UML diagram of models
uv run python manage.py graph_models -a -o models.png
# Run Django shell with auto-imports
uv run python manage.py shell_plus
# Clear all sessions
uv run python manage.py clear_cache
# Validate templates
uv run python manage.py validate_templates
# Show database info
uv run python manage.py sqlcreate
# Drop test database
uv run python manage.py drop_test_databaseThis project comes pre-configured with:
- django-allauth[socialaccount] (v65.13.1+) - Complete authentication system with social auth support
- dj-rest-auth (v7.0.1+) - REST API endpoints for authentication operations
- djangorestframework-simplejwt (v5.5.1+) - JWT authentication tokens
- smartmin (v5.2.2+) - Advanced permissions and user management
- djangorestframework - Powerful and flexible toolkit for building Web APIs
- drf-spectacular (v0.29.0+) - OpenAPI 3.0 schema generation and Swagger UI
- django-filter (v25.2+) - Dynamic QuerySet filtering
- psycopg[binary] (v3.2.12+) - PostgreSQL adapter for Python
- django-phonenumber-field[phonenumbers] (v8.3.0+) - Phone number field with validation
- django-extensions (v4.1+) - Custom management commands and model extensions
- django-author (v1.2.0+) - Automatic created_by/modified_by tracking
- django-auditlog (v3.3.0+) - Track model changes and user actions
- django-debug-toolbar (v6.1.0+) - Debug panel for Django applications
- django-browser-reload (v1.21.0+) - Auto-reload browser on code changes
- ruff (v0.14.6+) - Fast Python linter and formatter
- pytest-django (v4.11.1+) - Pytest plugin for Django
- pytest-sugar (v1.1.1+) - Enhanced test output with progress bar
- pytest-xdist (v3.8.0+) - Parallel test execution
- loguru (v0.7.3+) - Simplified logging with advanced features
- django-environ (v0.12.0+) - Environment variable management
- python-dotenv (v1.2.1+) - Load environment variables from .env file
- whitenoise (v6.11.0+) - Static file serving for production
shirobase/
โโโ apps/ # Django applications
โ โโโ accounts/ # Authentication endpoints & serializers
โ โโโ users/ # Custom User model and Profile
โโโ django_project/ # Main project configuration
โ โโโ settings.py # Project settings
โ โโโ urls.py # URL configuration
โ โโโ middleware.py # Custom middleware (CSRF handling)
โ โโโ permissions.py # Permission definitions
โ โโโ wsgi.py # WSGI application
โโโ templates/ # HTML templates
โโโ static/ # Static files (CSS, JS, images)
โโโ logs/ # Application logs
โโโ pyproject.toml # Project dependencies and metadata
โโโ uv.lock # Locked dependencies
โโโ pytest.ini # Pytest configuration
โโโ ruff.toml # Ruff linter configuration
โโโ Dockerfile # Docker container definition
โโโ entrypoint.sh # Docker entrypoint script
โโโ manage.py # Django management script
โโโ db.sqlite3 # SQLite database (development)
โโโ README.md # This file
The project is configured with:
- Custom User Model:
apps.users.Userwith email authentication - JWT Tokens: Access and refresh tokens with blacklist support
- Email Verification: Optional (can be set to 'mandatory' or 'none')
- Login Methods: Email-based authentication
- Session + JWT: Both session and JWT authentication enabled
Custom middleware included:
- CustomCsrfViewMiddleware: Exempts API endpoints from CSRF (configurable via
CSRF_EXEMPT_URLS) - LoginRequiredMiddleware: Enforces authentication site-wide (configure exemptions as needed)
- WhiteNoiseMiddleware: Serves static files efficiently in production
- AuditlogMiddleware: Tracks all model changes automatically
Loguru is configured to:
- Write logs to
logs/shirobase.log - Rotate log files at 10 MB
- Retain logs for 10 days
- Development: Served by Django
- Production: Served by WhiteNoise
- Static files directory:
static/ - Collected static files:
staticfiles/
This is a skeleton project meant to be customized for your specific needs:
- Rename the project: Update
django_projectfolder and all references to match your application name - Add your Django apps: Create new apps in the
apps/directory - Configure database: Switch between SQLite (development) and PostgreSQL (production) via environment variables
- Customize authentication: Extend the User and Profile models in
apps/users/models.py - Add permissions: Define custom permissions in
django_project/permissions.py - Configure CSRF: Add your domains to
CSRF_TRUSTED_ORIGINSin settings - Add business logic: Build your features using the pre-configured foundation
Issue: ModuleNotFoundError when running commands
# Make sure you're using uv run before python commands
uv run python manage.py runserverIssue: Database migration conflicts
# Reset migrations (development only!)
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
find . -path "*/migrations/*.pyc" -delete
uv run python manage.py makemigrations
uv run python manage.py migrateIssue: Static files not loading
# Collect static files
uv run python manage.py collectstatic --noinputIssue: CSRF errors on API endpoints
- Ensure your API URLs are prefixed with
/api(configured inCSRF_EXEMPT_URLS) - Or add your custom patterns to
CSRF_EXEMPT_URLSin settings
Issue: Login required on public pages
- Configure
LOGIN_EXEMPT_URLSor modifyLoginRequiredMiddlewarebehavior in settings
This is a base template project. Feel free to fork and customize it for your needs.
- MIT
Completed:
- โ Pre-configured Django apps (users, accounts)
- โ Docker configuration
- โ API documentation setup (drf-spectacular)
- โ Multiple commonly used packages integrated
Planned:
- Add CI/CD pipeline examples (GitHub Actions, GitLab CI)
- Celery integration for async tasks
- Redis caching setup
- Email template examples
- Frontend integration examples (React/Vue)
- Production deployment guides (AWS, DigitalOcean, Railway)
- Social authentication providers setup
- File upload handling (S3/local storage)
- API rate limiting
- Monitoring and error tracking setup
For issues, questions, or contributions, please refer to the project's issue tracker.
Built with โค๏ธ to accelerate Django development