Fix hardcoded domain redirect: Set FRONTEND_URL in production
This commit is contained in:
@@ -9,8 +9,14 @@ from .multitenancy import env, INSTALLED_APPS, MIDDLEWARE, DATABASES, REDIS_URL,
|
|||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
|
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
|
||||||
SECRET_KEY = env("DJANGO_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
|
||||||
|
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
|
||||||
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=["smoothschedule.com"])
|
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
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
DATABASES["default"]["CONN_MAX_AGE"] = env.int("CONN_MAX_AGE", default=60)
|
DATABASES["default"]["CONN_MAX_AGE"] = env.int("CONN_MAX_AGE", default=60)
|
||||||
|
|||||||
@@ -6,13 +6,18 @@ from core.models import Tenant, Domain
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
def ensure_production_domain():
|
def ensure_production_domain():
|
||||||
# Get the public tenant
|
# Get or create the public tenant
|
||||||
try:
|
public_tenant, created = Tenant.objects.get_or_create(
|
||||||
public_tenant = Tenant.objects.get(schema_name='public')
|
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}")
|
print(f"Found public tenant: {public_tenant.name}")
|
||||||
except Tenant.DoesNotExist:
|
|
||||||
print("Error: Public tenant not found!")
|
|
||||||
return
|
|
||||||
|
|
||||||
# Check for smoothschedule.com domain
|
# Check for smoothschedule.com domain
|
||||||
domain_name = 'smoothschedule.com'
|
domain_name = 'smoothschedule.com'
|
||||||
@@ -47,5 +52,4 @@ def ensure_production_domain():
|
|||||||
else:
|
else:
|
||||||
print(f"Domain already exists: {www_domain.domain}")
|
print(f"Domain already exists: {www_domain.domain}")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
ensure_production_domain()
|
||||||
ensure_production_domain()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user