Skip to content

Commit 59787da

Browse files
committed
Settings - Update for Django
1 parent 397d89b commit 59787da

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

core/settings.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Copyright (c) 2019 - present AppSeed.us
44
"""
55

6-
import os
6+
import os, random, string
77

88
from dotenv import load_dotenv
99
from unipath import Path
@@ -16,13 +16,18 @@
1616
PROJECT_DIR = Path(__file__).parent
1717

1818
# SECURITY WARNING: keep the secret key used in production secret!
19-
SECRET_KEY = os.getenv('SECRET_KEY', 'S#perS3crEt_1122')
19+
SECRET_KEY = os.environ.get('SECRET_KEY')
20+
if not SECRET_KEY:
21+
SECRET_KEY = ''.join(random.choice( string.ascii_lowercase ) for i in range( 32 ))
2022

2123
# SECURITY WARNING: don't run with debug turned on in production!
2224
DEBUG = os.getenv('DEBUG', False)
2325

24-
# load production server from .env
25-
ALLOWED_HOSTS = ['localhost', '127.0.0.1', os.getenv('SERVER', '127.0.0.1')]
26+
# HOSTs List
27+
ALLOWED_HOSTS = ['localhost', '127.0.0.1']
28+
29+
# Add here your deployment HOSTS
30+
CSRF_TRUSTED_ORIGINS = ['http://localhost:8000', 'http://localhost:5085', 'http://127.0.0.1:8000', 'http://127.0.0.1:5085']
2631

2732
# Application definition
2833

0 commit comments

Comments
 (0)