~/talk

Load Django Settings from Environmental Variables with One Magical Line of Code

Talkat PyOhio 2021 · on Saturday, 2021-07-31· [django, devops-and-delivery]
slides:none on file

Small zero-dependency package DjEnv reads all environment variables matching DJANGO_ (skips DJANGO_SETTINGS_MODULE), trims spaces, auto-casts primitives via simple-env, parses JSON blobs into Python objects, and sets Django settings into the module namespace by writing into globals() after stripping the DJANGO_ prefix. Usage reduces to a single line from DjEnv.settings import * in settings.py. The code is tiny, inspects env names with a regex, and removes temporary variables after setting them.

AI-written summary · about

  1. 0:00Start
  2. 0:23Presentation Outline
  3. 1:21Simple-Env
  4. 3:27Globals()
  5. 4:22The Magic Line
  6. 4:48When to use DjEnv?
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.