Skip to content

Support sub-path deployment and add gunicorn - #38

Merged
FriggemannMichael merged 1 commit into
mainfrom
feat/subpath-deploy
Jul 7, 2026
Merged

Support sub-path deployment and add gunicorn#38
FriggemannMichael merged 1 commit into
mainfrom
feat/subpath-deploy

Conversation

@FriggemannMichael

Copy link
Copy Markdown
Owner

Enables serving the backend under a sub-path (coderr.friggemann.eu/backend) alongside the frontend at the domain root.

What

  • STATIC_URL and FORCE_SCRIPT_NAME are environment-driven (DJANGO_STATIC_URL, DJANGO_FORCE_SCRIPT_NAME). Setting DJANGO_FORCE_SCRIPT_NAME=/backend makes admin, static and all reverse()-generated URLs include the prefix.
  • Offer-detail links use reverse('offerdetail-detail', ...) instead of a hard-coded /api/... string, so they respect the sub-path too. Local output is unchanged (/api/offerdetails/<id>/).
  • Adds gunicorn (production WSGI server) to requirements.

Verification

  • pytest → 153 passed, coverage 98.6%
  • ruff check . / ruff format . --check
  • reverse('offerdetail-detail', ...) with DJANGO_FORCE_SCRIPT_NAME=/backend yields /backend/api/offerdetails/<id>/ on Linux.

- Make STATIC_URL and FORCE_SCRIPT_NAME environment-driven so the app can be
  served under a sub-path (e.g. /backend) with correct admin, static and
  reverse()-generated URLs.
- Build the offer-detail link with reverse() so it honours FORCE_SCRIPT_NAME
  instead of a hard-coded /api/ path.
- Add gunicorn to requirements for the production WSGI server.
@FriggemannMichael
FriggemannMichael merged commit 8c3d5eb into main Jul 7, 2026
1 check passed
@FriggemannMichael
FriggemannMichael deleted the feat/subpath-deploy branch July 7, 2026 14:00
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.

1 participant