Skip to content

Sync django-gunicorn-nginx with the updated tutorial - #954

Open
realpython-bot wants to merge 1 commit into
masterfrom
maintenance/django-nginx-gunicorn-20261127
Open

realpython-bot wants to merge 1 commit into
masterfrom
maintenance/django-nginx-gunicorn-20261127

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Maintenance sync of django-gunicorn-nginx/ with the current state of Securely Deploy a Django App With Gunicorn, Nginx, & HTTPS.

Changes

  • requirements/prod.txt: pin django-csp==3.7. Unpinned, pip now installs django-csp 4.x, which drops the CSP_* settings this project uses (CSP_STYLE_SRC). Matches the article's install command and dependencies field.
  • myapp/views.py: the file was empty, so myapp/urls.py failed on views.index and manage.py check crashed. Restored the index() view the tutorial shows.
  • project/settings.py: SECURE_REFERRER_POLICY set to "strict-origin-when-cross-origin" and SECURE_HSTS_SECONDS to 2_592_000 (30 days), matching the tutorial's settings and its final response-header listing.

Article draft: https://realpython.com/pbjt/blog/post/2728/change/
Maintenance card: https://trello.com/c/lJmGI1px

Verification

  • Fresh Python 3.8 venv with requirements/prod.txt (Django 3.2.25, gunicorn 20.1.0, django-csp 3.7)
  • manage.py check: no issues. manage.py migrate: OK
  • gunicorn --check-config -c config/gunicorn/prod.py: OK. Served /myapp/ under Gunicorn: 200 with Content-Security-Policy: style-src 'self' cdn.jsdelivr.net; default-src 'self' and Referrer-Policy: strict-origin-when-cross-origin
  • ruff@0.14.1 format --check and ruff@0.14.1 check: pass

🤖 Generated with Claude Code

…ploy a Django App With Gunicorn, Nginx, & HTTPS

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

This branch has not been deployed

No deployments
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