In brief
os.environ exposes process environment variables as text. A configured port, for example, needs conversion and validation before being used as a number.
Useful to know
os.environ exposes process environment variables as text. A configured port, for example, needs conversion and validation before being used as a number. [1]
Distinguish a missing setting from an empty string. A silent fallback for a required secret can hide a deployment problem. Do not print the entire environment in a public error because it may contain confidential information.
Sources
For further detail and to check the information: