1

I am experimenting with the python-decouple library using below code:


if __name__ == '__main__':
    TEMPLATE_DEBUG = config('TEMPLATE_DEBUG')
    DATABASE_URL = config('DATABASE_URL')
    print(TEMPLATE_DEBUG,'\n',DATABASE_URL)
    DEBUG=config('DEBUG', default=False, cast=bool)
    print('DEBUG-->', DEBUG)

.env file:

TEMPLATE_DEBUG=True
DATABASE_URL=mysql://myuser:mypassword@myhost/mydatabase

Is there a way to set nonexisting key-value pair within the .env file using decouple library?

For example, set TOKEN value within .env and keep updating it throughout the code as and when needed.

Vidhi
  • 11
  • 3

0 Answers0