Skip to content

Commit 2ca739c

Browse files
Allow Render.com hosts and CORS for deployment
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 71a91a9 commit 2ca739c

5 files changed

Lines changed: 16 additions & 6 deletions

File tree

‎.node-version‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18.20.3

‎.npmrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
legacy-peer-deps=true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18.20.3
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
legacy-peer-deps=true

‎time_complexity_analyzer/time_complexity_analyzer/settings.py‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
https://docs.djangoproject.com/en/5.0/ref/settings/
1111
"""
1212

13+
import os
1314
from pathlib import Path
1415

1516
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@@ -19,13 +20,15 @@
1920
# Quick-start development settings - unsuitable for production
2021
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
2122

22-
# SECURITY WARNING: keep the secret key used in production secret!
23-
SECRET_KEY = 'django-insecure-9zdo#lqr)h@a077%%fu4@x-j+y=_1t@jksij4apt+!rp_rgv#o'
23+
SECRET_KEY = os.environ.get(
24+
'DJANGO_SECRET_KEY',
25+
'django-insecure-9zdo#lqr)h@a077%%fu4@x-j+y=_1t@jksij4apt+!rp_rgv#o',
26+
)
2427

25-
# SECURITY WARNING: don't run with debug turned on in production!
26-
DEBUG = True
28+
DEBUG = os.environ.get('DEBUG', 'True').lower() in ('true', '1', 'yes')
2729

28-
ALLOWED_HOSTS = []
30+
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', 'localhost,127.0.0.1').split(',')
31+
ALLOWED_HOSTS += ['.onrender.com']
2932

3033

3134
# Application definition
@@ -56,7 +59,10 @@
5659
]
5760

5861
CORS_ALLOWED_ORIGINS = [
59-
"http://localhost:3000"
62+
"http://localhost:3000",
63+
]
64+
CORS_ALLOWED_ORIGIN_REGEXES = [
65+
r"^https://.*\.onrender\.com$",
6066
]
6167

6268
AUTHENTICATION_BACKENDS = [

0 commit comments

Comments
 (0)