Home / Glossary / Environment Variable
Tech & ITEnvironment Variable
By Sitraka Forler · Lecturer, Durham Business SchoolUpdated 13 September 2026 About this site
A named value set outside your code that a running program reads as configuration.
A process normally inherits NAME=value pairs from whatever started it, and Python reads them through os.environ. Teams keep settings and secrets such as DATABASE_URL there, so one build runs unchanged in development, staging and production. A .env file is not read by the operating system: a tool or library such as python-dotenv loads it, and a changed variable only reaches processes started afterwards.
Example
# bash or zsh: set a variable for this shell and the programs it starts
export APP_ENV=staging
python3 -c "import os; print(os.environ.get('APP_ENV', 'development'))"
# prints: staging
unset APP_ENV
python3 -c "import os; print(os.environ.get('APP_ENV', 'development'))"
# prints: development