Answers for "ENVIRONMENT VAR PYTHON"

9

python create environment variable

import os
os.environ['variable_name'] = 'variable_value'
Posted by: Guest on April-28-2020
0

creating environment variable in python

import os
from decouple import config

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = config('SECRET_KEY')
DEBUG = config('DEBUG', cast=bool)
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': config('DB_NAME'),
        'USER': config('DB_USER'),
        'PASSWORD': config('DB_PASSWORD'),
        'HOST': config('DB_HOST'),
        'PORT': '',
    }
}
Posted by: Guest on July-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language