Skip to content

Make Django settings proxy-aware and configurable via environment variables#1

Open
pythodoc wants to merge 1 commit into
mainfrom
codex/check-project-settings-for-deployment
Open

Make Django settings proxy-aware and configurable via environment variables#1
pythodoc wants to merge 1 commit into
mainfrom
codex/check-project-settings-for-deployment

Conversation

@pythodoc
Copy link
Copy Markdown
Owner

@pythodoc pythodoc commented Feb 6, 2026

Motivation

  • Prepare the app for Railway (or similar) deployments by allowing runtime configuration of debug, hosts, and SSL redirect settings.
  • Prevent HTTPS/redirect issues when the app is served behind Railway’s TLS termination by honoring forwarded-proto headers.

Description

  • Import os and make DEBUG driven by the DJANGO_DEBUG environment variable via DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'.
  • Allow extra hosts from the DJANGO_ALLOWED_HOSTS environment variable by appending parsed values to ALLOWED_HOSTS.
  • Make SECURE_SSL_REDIRECT configurable with DJANGO_SECURE_SSL_REDIRECT and add SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') and USE_X_FORWARDED_HOST = True to support proxy/terminator setups.
  • Updated paramount_holidayz/settings.py accordingly.

Testing

  • No automated tests were run because this is a configuration-only change; manual validation and runtime testing on the target environment are recommended.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6270593155

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

'paramount-holidayz-production.up.railway.app'
'paramount-holidayz-production.up.railway.app',
]
ALLOWED_HOSTS += [host for host in os.getenv('DJANGO_ALLOWED_HOSTS', '').split(',') if host]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Strip whitespace when parsing extra allowed hosts

The added parsing for DJANGO_ALLOWED_HOSTS does not trim whitespace, so a common env value like "example.com, www.example.com" yields " www.example.com" (leading space). Django treats that as a different, invalid host and will return 400 for requests to www.example.com. This only shows up when the env var includes spaces, which is typical in comma-separated lists. Consider stripping each entry before appending.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant