Welcome to the Django Starter Template!
A comprehensive starting point for your new API with Django and DRF.
Overview
This documentation provides a comprehensive guide to the Django Starter Template, a robust foundation for building modern APIs with Django and Django REST Framework. It covers everything from initial setup and development workflows to advanced features like authentication, background tasks, and automated documentation.
Quick Start
The recommended way to get started is by using the Dev Container feature in VS Code.
Prerequisites
To get started with the Dev Container, ensure you have the following installed:
- Visual Studio Code
- Docker Desktop
- Dev Containers extension for VS Code
Setup Steps
Follow these steps to set up your development environment using the Dev Container:
-
Use the GitHub Template: Begin by creating your own repository from the Django Starter Template GitHub page by clicking the green
Use this template
button. -
Open in VS Code: Clone your newly created repository to your local machine and open the project folder in Visual Studio Code.
-
Check the Setup Guide: Before proceeding, consult the
Todo Tree
view in the VS Code sidebar. This provides a guided checklist of initial setup tasks to ensure a smooth start. -
Reopen in Container: Upon opening the project, VS Code will prompt you to "Reopen in Container." Click this option to build and launch the development environment. This process automatically configures essential services like Redis, Celery, and PostgreSQL, installs all project dependencies, and applies database migrations.
-
Create a Superuser: Once the container is ready, create an administrative user for accessing the Django admin interface by running:
python manage.py createsuperuser
. -
Start the Server: Launch the Django development server with:
python manage.py runserver
.
Your API should now be running and accessible at http://127.0.0.1:8000
.
Key Features
This template comes equipped with a rich set of features designed to accelerate your API development:
- User Authentication: Implements secure, token-based authentication using
django-rest-knox
, providing a robust system for user management and access control. - Background Tasks: Leverages
Celery
andRedis
for efficient asynchronous task processing, enabling your application to handle long-running operations without blocking the main thread. - API Documentation: Features automatic OpenAPI 3 schema generation with
drf-spectacular
, ensuring your API documentation is always up-to-date and easily explorable via Swagger UI. - Centralized Logging: Provides a structured JSON logging system for comprehensive and easily parsable application logs, facilitating monitoring and debugging.
- Custom User Model: Utilizes a custom user model with email-based authentication, offering flexibility and a modern approach to user identity.
- GitHub Copilot Prompts: Includes a collection of useful prompts tailored to enhance your development experience with GitHub Copilot, boosting productivity.
- Comprehensive Documentation: This documentation serves as a detailed guide to all features and functionalities, helping you maximize the template's potential.
Explore the Documentation
This documentation is your comprehensive guide to building robust applications with the Django Starter Template. Use the navigation on the left to explore various aspects of the project:
- Development: Learn about the development workflow, including how to run tests, and utilize provided scripts.
- Project Structure: Gain an overview of the project's directory structure and organization.
- Project Settings: Understand the available settings and how to configure your project for different environments.
- Dependencies: Review a detailed list of all the project's dependencies and their purposes.
- Authentication: Dive into the authentication system, covering user management and API endpoints.
- Core Application: Discover the core functionalities and essential API endpoints provided by the
apps/core
application. - Logging: Understand the structured logging system and how to effectively use it for monitoring and debugging.
- Celery Tasks: Learn how to create, manage, and monitor background tasks using Celery.
- Rate Limiting: Configure and understand rate limiting to protect your API from abuse and ensure fair usage.
- Database Seeding: Learn how to populate your database with initial data for development and testing.
- Testing: Understand how to write and run tests for your project to ensure code quality and reliability.
- Environment Setup: Get detailed instructions on setting up your development environment.
- AI Tools: Explore useful prompts to enhance your development experience with GitHub Copilot, Gemini CLI agent, and Roo Code.