0

Is there a simple and elegant way to extract all variables from a dict to the current module locals? I am using Django and we would like to load all values of the local_settings.py file which is something like:

DEBUG=True
KEY="VALUE"
NUMKEY=1
...

from a json, which will be compatible:

{ "DEBUG": true, "Key": "VALUE", "NUMKEY": 1 }

so I'm looking for a simple way to extract all into the local variables of the settings.py file.

EDIT: so inside my local_settings.py I will have something like:

   JSON_VALUES = {...}
   # here i would like to extract all the JSON_VALUES to variables.
   # in the most elegant possible way :)
   # ex: DEBUG = JSON_VALUES['DEBUG']

Thank you!

ET-CS
  • 6,334
  • 5
  • 43
  • 73

0 Answers0