Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Django security best practices: authentication, authorization, CSRF, SQL injection, XSS defense, and production hardening.
96% 100%+4 ptsof test cases passed
Passed 24 of 24 test cases with the skill, and 23 of 24 without it.
3 of 3 safety checks passed
Not used yet
针对 Django 应用程序的全面安全指南,旨在防范常见脆弱性。
# settings/production.py
import os
DEBUG = False # 重要:在生产环境中绝对不要设置为 True
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(',')
# 安全响应头(Security Headers)
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_HSTS_SECONDS = 31536000 # 1年
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
X_FRAME_OPTIONS = 'DENY'
# HTTPS 与 Cookie
SESSION_COOKIE_HTTPONLY = True
CSRF_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = 'Lax'
CSRF_COOKIE_SAMESITE = 'Lax'
Published skills whose descriptions closely match this one, with their benchmark result.
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.