From 9eb07a87e6f42a25a7a2934bcd390c555fabe2f7 Mon Sep 17 00:00:00 2001 From: poduck Date: Sun, 30 Nov 2025 01:59:29 -0500 Subject: [PATCH] Fix hardcoded domain redirect: Set FRONTEND_URL in production --- smoothschedule/config/settings/production.py | 6 ++++++ .../scripts/ensure_production_domain.py | 20 +++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/smoothschedule/config/settings/production.py b/smoothschedule/config/settings/production.py index 876c34f..e68234a 100644 --- a/smoothschedule/config/settings/production.py +++ b/smoothschedule/config/settings/production.py @@ -9,8 +9,14 @@ from .multitenancy import env, INSTALLED_APPS, MIDDLEWARE, DATABASES, REDIS_URL, # https://docs.djangoproject.com/en/dev/ref/settings/#secret-key SECRET_KEY = env("DJANGO_SECRET_KEY") # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts +# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=["smoothschedule.com"]) +# FRONTEND +# ------------------------------------------------------------------------------ +FRONTEND_URL = env("FRONTEND_URL", default="https://platform.smoothschedule.com") +PLATFORM_BASE_URL = env("PLATFORM_BASE_URL", default="https://platform.smoothschedule.com") + # DATABASES # ------------------------------------------------------------------------------ DATABASES["default"]["CONN_MAX_AGE"] = env.int("CONN_MAX_AGE", default=60) diff --git a/smoothschedule/scripts/ensure_production_domain.py b/smoothschedule/scripts/ensure_production_domain.py index e459fca..a8d3c28 100644 --- a/smoothschedule/scripts/ensure_production_domain.py +++ b/smoothschedule/scripts/ensure_production_domain.py @@ -6,13 +6,18 @@ from core.models import Tenant, Domain from django.conf import settings def ensure_production_domain(): - # Get the public tenant - try: - public_tenant = Tenant.objects.get(schema_name='public') + # Get or create the public tenant + public_tenant, created = Tenant.objects.get_or_create( + schema_name='public', + defaults={ + 'name': 'Public Tenant', + 'subscription_tier': 'PROFESSIONAL', # Default tier + } + ) + if created: + print(f"Created public tenant: {public_tenant.name}") + else: print(f"Found public tenant: {public_tenant.name}") - except Tenant.DoesNotExist: - print("Error: Public tenant not found!") - return # Check for smoothschedule.com domain domain_name = 'smoothschedule.com' @@ -47,5 +52,4 @@ def ensure_production_domain(): else: print(f"Domain already exists: {www_domain.domain}") -if __name__ == '__main__': - ensure_production_domain() +ensure_production_domain()