File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 147147DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
148148
149149if DEBUG :
150- CORS_ALLOWED_ORIGINS = [
151- env .str ('VISUAL_CIRCUIT_FRONTEND_HOST' )
152- ]
150+ # Accept a comma-separated list of frontend hosts (e.g. http://localhost:4000)
151+ # Also automatically append standard fallback ports if the primary port gets busy
152+ base_origins = [origin .strip () for origin in env .str ('VISUAL_CIRCUIT_FRONTEND_HOST' ).split (',' )]
153+ CORS_ALLOWED_ORIGINS = list (base_origins )
154+
155+ # If using localhost:4000, dynamically add 4001 and 4002 as fallbacks
156+ for origin in base_origins :
157+ if origin .endswith (':4000' ):
158+ CORS_ALLOWED_ORIGINS .extend ([
159+ origin .replace (':4000' , ':4001' ),
160+ origin .replace (':4000' , ':4002' )
161+ ])
153162# if DEBUG:
154163# CORS_ALLOWED_ORIGINS = [
155164# env.str('VISUAL_CIRCUIT_FRONTEND_HOST'),
You can’t perform that action at this time.
0 commit comments