File tree 3 files changed +14
-4
lines changed
3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 2
2
"""Django's command-line utility for administrative tasks."""
3
3
import os
4
4
import sys
5
-
5
+ import dotenv
6
+ import pathlib
6
7
7
8
def main ():
8
9
"""Run administrative tasks."""
10
+ # DOT_ENV_PATH = pathlib.Path() / '.env'
11
+ # if DOT_ENV_PATH.exists():
12
+ # dotenv.read_dotenv(str(DOT_ENV_PATH))
13
+ # else:
14
+ # print("No .env found, be sure to make it.")
15
+ dotenv .read_dotenv ()
9
16
os .environ .setdefault ('DJANGO_SETTINGS_MODULE' , 'trydjango.settings' )
10
17
try :
11
18
from django .core .management import execute_from_command_line
Original file line number Diff line number Diff line change 1
1
django >= 3.2 ,< 3.3
2
+ django-dotenv
Original file line number Diff line number Diff line change 10
10
https://docs.djangoproject.com/en/3.2/ref/settings/
11
11
"""
12
12
13
+ import os
13
14
from pathlib import Path
14
15
15
16
# Build paths inside the project like this: BASE_DIR / 'subdir'.
20
21
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
21
22
22
23
# SECURITY WARNING: keep the secret key used in production secret!
23
- SECRET_KEY = ' django-insecure-0+dmu6*lky0l743o^=)8-^27tn0)dzoi)6-lzb1i)egsso_84h'
24
+ SECRET_KEY = os . environ . get ( 'SECRET_KEY' , ' django-insecure-0+dmu6*lky0l743o^=)8-^27tn0)dzoi)6-lzb1i)egsso_84h')
24
25
25
26
# SECURITY WARNING: don't run with debug turned on in production!
26
- DEBUG = True
27
+ DEBUG = str ( os . environ . get ( 'DEBUG' )) == "1" # 1 == True
27
28
28
29
ALLOWED_HOSTS = []
29
-
30
+ if not DEBUG :
31
+ ALLOWED_HOSTS += [os .environ .get ('ALLOWED_HOST' )]
30
32
31
33
# Application definition
32
34
# python manage.py makemigrations
You can’t perform that action at this time.
0 commit comments