Back to guide/AI Tool Configs

CLAUDE.md — Django + DRF + Celery

CLAUDE.md template for Django REST Framework projects with Celery task queues and split settings.

claude-mdpythondjangoceleryai-config
Edit View
Prompt
# CLAUDE.md

## Project Overview
{{project_name}}{{one-line description}}

## Tech Stack
- Language: Python 3.11+
- Framework: Django 5.0+ / Django REST Framework
- Task Queue: Celery + Redis
- Database: PostgreSQL
- Testing: pytest-django
- Linting: ruff

## Commands
```bash
python manage.py runserver           # Dev server
python manage.py test                # Run tests
celery -A config worker --loglevel=info  # Start worker
python manage.py makemigrations      # Generate migrations
python manage.py migrate             # Apply migrations
```

## Directory Structure
```
config/                  # Django project settings
├── settings/
│   ├── base.py          # Shared settings
│   ├── local.py         # Dev overrides
│   └── production.py    # Prod overrides
apps/
├── {{app_name}}/
│   ├── models.py
│   ├── serializers.py   # DRF serializers
│   ├── views.py         # ViewSets
│   ├── urls.py
│   ├── tasks.py         # Celery tasks
│   ├── services.py      # Business logic
│   └── tests/
```

## Conventions
- Fat models, thin views — complex logic in model methods or services.py
- Use ModelSerializer for standard CRUD, custom serializers for complex input
- Celery tasks for anything that takes > 500ms
- Always use select_related/prefetch_related to avoid N+1 queries
- Permissions in permissions.py, not inline in views
- Use Django signals sparingly — prefer explicit service calls

Variables to customize

{{project_name}}{{one-line description}}{{app_name}}

Why this prompt works

'Celery tasks for anything > 500ms' is an actionable rule Claude can apply consistently. The split settings pattern tells Claude which file to edit for environment-specific changes.

Save this prompt to your library

Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.