Refactor Docker and Django configuration

- Update Dockerfile to use Python 3.11-slim and optimize build steps
- Remove Dockerfile.prod and update docker-compose.yml
- Remove entrypoint.sh and twilio dependency
- Modify Django settings for production security and configuration
- Update user serializer to include group permissions
- Enhance CSRF and SSL configuration settings
This commit is contained in:
2025-02-12 19:27:05 +05:00
parent 871d604ef4
commit fea31cd651
6 changed files with 35 additions and 38 deletions

View File

@ -31,8 +31,7 @@ SECRET_KEY = config("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config("DEBUG", cast=bool)
if not DEBUG:
ALLOWED_HOSTS = str(config("DJANGO_ALLOWED_HOSTS", cast=str)).split(" ")
if DEBUG:
INTERNAL_IPS = [
"127.0.0.1",
@ -318,16 +317,16 @@ logging.config.dictConfig(
)
if not DEBUG:
SECURE_SSL_REDIRECT = True
SECURE_SSL_REDIRECT = config("DJANGO_SECURE_SSL_REDIRECT", cast=bool)
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_HSTS_SECONDS = config("SECURE_HSTS_SECONDS", cast=int)
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = True
CSRF_TRUSTED_ORIGINS = [config("CSRF_ALLOWED_HOST")]
CSRF_TRUSTED_ORIGINS = [config("CSRF_TRUSTED_ORIGINS")]
CSRF_COOKIE_DOMAIN = config("CSRF_COOKIE_DOMAIN")
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
ALLOWED_HOSTS = str(config("ALLOWED_HOSTS", cast=str)).split(" ")
EMAIL_BACKEND = (
"django.core.mail.backends.smtp.EmailBackend" # Replace with your preferred backend