python decouple

707 ワード

install python-decopule

pip install python-decouple

.env

DEBUG = True
TEMPLATE_DEBUG = True
SECRET_KEY = yoursecretkey

settings.py

from decopule import config

DEBUG = config('DEBUG', cast=bool)
SECRET_KEY = config('SECRET_KEY')

EMAIL_HOST = config('EMAIL_HOST', default='localhost')

Reference

  • https://thesaintraphael.medium.com/django-and-python-decouple-8dd39c56b56