A hands-on project for learning Python application configuration, environment variables, dependency management, and Git.
config/appsettings.json— example application settings.config_demo.py— loads and validates environment-based configuration.requirements.txt— records the Python package versions used by the project..gitignore— excludes local virtual environments, environment files, and Python-generated files.
- Python 3.14 or a compatible Python version.
- pip.
- A terminal such as PowerShell.
Create and activate a virtual environment:
py -3.14 -m venv .venv
.\.venv\Scripts\Activate.ps1Install the dependencies:
python -m pip install -r requirements.txtCreate a local .env file containing the required settings:
APP_MODE=development
API_BASE_URL=https://api.example.com
TIMEOUT_SECONDS=10
The application accepts development, testing, or production as application modes. The API base URL must use HTTP or HTTPS and include a hostname. The timeout must be a positive integer.
python config_demo.pyThe example validates the configuration and prints the selected application mode, API base URL, and timeout.
Security: Do not commit real credentials, API keys, tokens, or other secrets. The .env file is intended to remain local.
This project is used to practice Python configuration, dependency management, version control, and reproducible development workflows.