Answers for "python call environment variable"

9

python create environment variable

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

creating environment variable in python

$ pip install python-decouple
Posted by: Guest on July-21-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

Code answers related to "python call environment variable"

Python Answers by Framework

Browse Popular Code Answers by Language