Skip to content

Modernize template: uv, Django 6.1, env-based settings, CI - #43

Merged
npv2k1 merged 2 commits into
mainfrom
chore/uv-2026-template
Sep 26, 2026
Merged

npv2k1 merged 2 commits into
mainfrom
chore/uv-2026-template

Conversation

@npv2k1

@npv2k1 npv2k1 commented Sep 26, 2026

Copy link
Copy Markdown
Member

Summary

  • uv: pyproject.toml + uv.lock replace requirements.txt; Python 3.13+
  • Django 6.1, drf-spectacular (replaces unmaintained drf-yasg / rest-swagger / coreapi)
  • Env-based settings via django-environ: DATABASE_URL, EMAIL_URL (mapped to the new MAILERS setting), CORS/CSRF/hosts
  • Production-ready: secure defaults when DEBUG=false, whitenoise, gunicorn, /health/, uv multi-stage Dockerfile, compose.yaml with Postgres
  • Quality: ruff lint/format, pytest-django tests
  • CI: lockfile check, lint, test matrix (Python 3.13/3.14 × SQLite/Postgres), check --deploy
  • Open source: MIT LICENSE, CONTRIBUTING, SECURITY, issue/PR templates, Dependabot (uv, actions, docker)

Test plan

  • make lint, make test locally (3.13 and 3.14)
  • manage.py check --deploy passes at error level
  • Docker image builds and runs
  • CI green (incl. Postgres matrix)

🤖 Generated with Claude Code

- Replace requirements.txt with pyproject.toml + uv.lock (Python 3.13+)
- Upgrade to Django 6.1; swap unmaintained drf-yasg/rest-swagger for drf-spectacular
- Read settings from env/.env via django-environ (DATABASE_URL, EMAIL_URL -> MAILERS)
- Production defaults: secure cookies/SSL redirect when DEBUG=false, whitenoise, gunicorn
- uv-based multi-stage Dockerfile and compose.yaml with Postgres
- Ruff lint/format and pytest-django tests
- CI: lockfile check, lint, test matrix (py3.13/3.14 x sqlite/postgres), deploy check
- Dependabot, LICENSE, CONTRIBUTING, SECURITY, issue/PR templates

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread .github/workflows/ci.yml Outdated
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v6
Comment thread .github/workflows/ci.yml Outdated
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v6
Comment thread .github/workflows/ci.yml Outdated
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v6
Comment thread compose.yaml Outdated
environment:
POSTGRES_DB: app
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Comment thread Dockerfile Outdated

COPY . /app
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-dev
Comment thread .github/workflows/ci.yml Outdated
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --locked
Comment thread .github/workflows/ci.yml
env:
POSTGRES_DB: app
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Comment thread .github/workflows/ci.yml Outdated
run: uv run --locked ruff check --output-format=github .

- name: Ruff format
run: uv run --locked ruff format --check .
Comment thread .github/workflows/ci.yml Outdated
run: uv lock --locked

- name: Ruff lint
run: uv run --locked ruff check --output-format=github .
Comment thread apps/urls.py
path('auth/', include('djoser.urls')),
path('auth/', include('djoser.urls.jwt')),

def health(request):
- Pin all GitHub Actions to commit SHAs (Dependabot keeps them updated)
- Install with --locked --no-build and run with --no-sync in CI and Docker
- Fix release.yml sha tag producing ":-<sha>" on pull requests
- Allow overriding compose credentials via env; restrict /health/ to GET

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@npv2k1
npv2k1 merged commit d9a5dca into main Sep 26, 2026
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants