Answers for "what is environment variables in 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

DEBUG = config('DEBUG', cast=bool)
EMAIL_PORT = config('EMAIL_PORT', cast=int)
Posted by: Guest on July-08-2021
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 "what is environment variables in python"

Python Answers by Framework

Browse Popular Code Answers by Language