{{ cookiecutter.description }}
Created by: {{ cookiecutter.author_name }}
- Twitter: @iampaullilian
- GitHub: asbilim
- Portfolio: paullilian.dev
- Auto-generated API: Automatically creates REST API endpoints for all models registered in the Django admin.
- Dashboard Analytics: A new
/api/admin/dashboard-stats/endpoint provides a comprehensive overview of site activity, including user signups, content creation statistics, and recent activities. - Pre-built Blog App: Includes a full-featured, RESTful blog API with posts, categories, tags, comments, and more.
- Dynamic Configuration: Manage site settings like email and file storage directly through the API.
- Enhanced Site Identity: More detailed site identity management, including author information, contact details, and social media links.
- Admin User Preferences: Users can have their own admin UI preferences, such as theme and layout density.
- API Request Logging: Automatically logs API requests for analytics and monitoring.
- Site Identity & SEO: Manage your site's name, logo, favicon, and SEO tags from a central place.
- User & Group Management: Super admins can manage users and groups via the API.
- Frontend Ready: Provides configuration endpoints for easy integration with a frontend dashboard.
- Customizable: Easily extend and customize serializers, viewsets, and permissions.
- Automatic Translations: All text fields are available in English, German and French. The public-facing APIs (like the Blog API) serve translated content based on the
Accept-Languageheader. See theBLOG_API_GUIDE.mdfor more details. - UI Component Metadata: Each API response includes suggested components for creating, editing and displaying fields, plus predefined choices for things like icons and categories to ensure a consistent look and feel.
-
Setup Environment
python -m venv venv source venv/bin/activate # Linux/Mac # or venv\Scripts\activate # Windows
-
Install Dependencies
pip install -r requirements.txt
-
Environment Variables
Create a
.envfile from the example:cp .env.example .env
Then, edit the
.envfile with your settings. See the.env.examplefile for detailed explanations of each variable. This now includes optional configuration for Cloudflare R2 storage. -
Database Setup
python manage.py migrate python manage.py createsuperuser
-
Run Development Server
python manage.py runserver
-
(Optional) Create Dummy Data
To populate the database with some sample data for testing, you can run the following command:
python manage.py create_dummy_todos
- Admin API Root:
http://localhost:8000/api/admin/ - Dashboard Analytics:
http://localhost:8000/api/admin/dashboard-stats/ - API for a model:
http://localhost:8000/api/admin/models/<model-name>/ - Blog API:
- Posts:
http://localhost:8000/api/blog/posts/ - Categories:
http://localhost:8000/api/blog/categories/ - Tags:
http://localhost:8000/api/blog/tags/ - Search:
http://localhost:8000/api/blog/search/?q=<query>
- Posts:
- Traditional Admin:
http://localhost:8000/admin/ - API Schema:
http://localhost:8000/api/schema/(Download OpenAPI Schema)http://localhost:8000/api/schema/swagger-ui/(Swagger UI)http://localhost:8000/api/schema/redoc/(Redoc)
This project uses JWT for authentication. Here is a summary of the authentication and user management endpoints.
-
Get Tokens (Login Step 1):
POST /api/token/- Provide
usernameandpassword. - If 2FA is disabled, this returns
accessandrefreshtokens directly. - If 2FA is enabled, it returns a temporary message:
{"detail": "OTP required.", "is_2fa_enabled": true}.
- Provide
-
Verify 2FA and Get Tokens (Login Step 2):
POST /api/auth/token/verify/- If 2FA is enabled, use this endpoint.
- Provide
username,password, and theotpfrom an authenticator app. - On success, this returns the final
accessandrefreshtokens. - Note: If you receive an "Invalid OTP" error, please ensure your phone's clock is synchronized with an internet time server.
-
Refresh Token:
POST /api/token/refresh/- Provide the
refreshtoken to get a newaccesstoken.
- Provide the
- Request Reset:
POST /api/auth/password_reset/- Provide the user's
emailto receive a password reset link.
- Provide the user's
- Confirm Reset:
POST /api/auth/password_reset/confirm/- Provide the
tokenfrom the email and anew_password.
- Provide the
These endpoints require an active access token in the authorization header.
- User Profile:
GET /api/auth/me/: Retrieve the current user's profile (`