DEV Community

Discussion on: Django Cheat Sheet: Keep Credentials Secure with Environment Variables

Collapse
 
guettli profile image
Thomas Güttler

Don't ask my why the author did not accept my PR: github.com/theskumar/python-dotenv...

Converting types

The library reads and provides strings. If you need for example a boolean, it is up to you to convert the value.

Example:

from distutils.util import strtobool
DEBUG = bool(strtobool(os.getenv('DEBUG', 'True')))
Enter fullscreen mode Exit fullscreen mode