mirror of
https://github.com/creyD/asiimov.git
synced 2026-06-12 00:52:23 +02:00
Settings now pull env variables instead of fixed values
This commit is contained in:
@@ -1,26 +1,24 @@
|
||||
"""
|
||||
Django settings for asiimov project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 3.0.2.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/3.0/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/3.0/ref/settings/
|
||||
Django settings for the asiimov project.
|
||||
"""
|
||||
|
||||
# IMPORTS
|
||||
import os
|
||||
# For generating new SECRET_KEY
|
||||
from django.core.management.utils import get_random_secret_key
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
|
||||
# HELPER for env variables
|
||||
def get_env_value(env_variable):
|
||||
if not env_variable in os.environ:
|
||||
os.environ[env_variable] = get_random_secret_key()
|
||||
return os.environ[env_variable]
|
||||
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'o1lv=a%9l7bl$07!u*75&6_l^q%^f_eowd2j$wtd#fhtq9wa8f'
|
||||
SECRET_KEY = get_env_value('DJANGO_SECRET_KEY')
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
@@ -119,3 +117,4 @@ USE_TZ = True
|
||||
# https://docs.djangoproject.com/en/3.0/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STEAM_API_KEY = os.environ['STEAM_API_KEY']
|
||||
|
||||
Reference in New Issue
Block a user