Fix hardcoded domain redirect: Set FRONTEND_URL in production

This commit is contained in:
poduck
2025-11-30 01:59:29 -05:00
parent 613acf17c1
commit 9eb07a87e6
2 changed files with 18 additions and 8 deletions

View File

@@ -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)

View File

@@ -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()