viewflow/seedkit / skills/django-seedkit
django-seedkit
FlaggedBootstrap a new Django project, or add components — auth (allauth, magic-link, axes, 2FA), payments (Stripe, dj-stripe), REST (django-modern-rest, django-bolt), Celery / Django Tasks, async views & WebSockets (ASGI, uvicorn worker, django-channels, channels-redis), Tailwind+DaisyUI, favicon, SEO meta tags + sitemap, HTML email templates, S3 storage, structlog, healthchecks, Docker, CI, deploy (VPS / Fly / GitHub-SSH), dbbackup, Sentry/Bugsink — to an existing Django codebase. Use whenever the user wants to scaffold Django, integrate a Django package, set up async / WebSockets, set up production deploys, wire CI/CD, or extend an existing Django project.
references/logging.md
View on GitHub# Logging — structured (structlog + django-structlog)
Docs: <https://www.structlog.org/> · <https://django-structlog.readthedocs.io/>
Pretty console in dev, JSON lines in prod. Foreign loggers (Django, Celery, urllib3) render identically because both renderers are stdlib `logging` formatters wrapped by `ProcessorFormatter`. `django-structlog` ships the request middleware and Celery signal handlers — per-request `request_id`, `correlation_id`, `user_id` and per-task `task_id`/`task_name` flow via `contextvars` without project code.
## Install
```sh
uv add structlog django-structlog
```
## Settings
In `config/settings.py` (or `config/settings/base.py` for split):
```python
import structlog
# Shared chain. Used as `foreign_pre_chain` (stdlib records) and inside
# structlog.configure() (structlog-native records). Each record runs it once.
PRE_CHAIN = [
structlog.contextvars.merge_contextvars,
structlog.stdlib.add_log_level,
structlog.stdlib.add_logger_name,
structlog.processors.TimeStamper(fmt="iso", utc=True),
structlog.processors.StackInfoRenderer(),
structlog.processors.format_exc_info,
]
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"json": {
"()": "structlog.stdlib.ProcessorFormatter",
"processor": structlog.processors.JSONRenderer(),
"foreign_pre_chain": PRE_CHAIN,
},
"console": {
"()": "structlog.stdlib.ProcessorFormatter",
"processor": structlog.dev.ConsoleRenderer(colors=True),
"foreign_pre_chain": PRE_CHAIN,
},
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"formatter": "console" if DEBUG else "json",
},
},
"root": {"handlers": ["console"], "level": "INFO"},
"loggers": {
"django.db.backends": {"level": "WARNING"},
"django.request": {"level": "WARNING"},
"urllib3": {"level": "WARNING"},
"botocore": {"level": "WARNING"},
"celery": {"level": "INFO"},
},
}
structlog.configure(
processors=[*PRE_CHAIN, structlog.stdlib.ProcessorFormatter.wrap_for_formatter],
logger_factory=structlog.stdlib.LoggerFactory(),
wrapper_class=structlog.stdlib.BoundLogger,
cache_logger_on_first_use=True,
)
```
## Per-request context
Add `django_structlog` to `INSTALLED_APPS` and insert its middleware **after** `AuthenticationMiddleware` (`request.user` must exist before the middleware binds `user_id`):
```python
auth_idx = MIDDLEWARE.index("django.contrib.auth.middleware.AuthenticationMiddleware")
MIDDLEWARE.insert(auth_idx + 1, "django_structlog.middlewares.RequestMiddleware")
```
Always-on. `LOGGING` belongs at module scope in `base.py` — never inside an `if DEBUG:` block, or production runs with bare Django defaults (no console handler at the root level).
For Celery, add `django_structlog.celery.steps.DjangoStructLogInitStep` to the app's boot steps — it binds `task_id` / `task_name` and propagates the parent request's `correlation_id`. This is a one-line delta to the existing `config/celery.py` from `references/tasks-celery.md`; do **not** rewrite the file from scratch:
```python
# config/celery.py — additions only
from django_structlog.celery.steps import DjangoStructLogInitStep
# ... existing Celery() / config_from_object / autodiscover_tasks lines stay ...
app.steps["worker"].add(DjangoStructLogInitStep)
```
## Sentry / GlitchTip / Bugsink
If `error-reporting.md` is in use, sentry-sdk's `LoggingIntegration` already routes `WARNING+` to breadcrumbs and `ERROR+` to events. Override per-logger via `LoggingIntegration(level=…, event_level=…)`.
## Pitfalls
- Call `structlog.configure()` only from settings (loaded once, before any logger).
- Keep `cache_logger_on_first_use=True`.
- No `ConsoleRenderer` in prod — ANSI codes break JSON parsers.
- `log.exception(...)` already implies `exc_info=True`; don't pass it again.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |