Never put secrets in your code
When working with APIs or databases, you’ll need:
- API keys
- Passwords
- Connection strings
Putting these directly in your code is dangerous - anyone can see them!
The solution
Environment variables let you keep secrets separate from your code. We’ll learn two approaches:
Most Python projects use .env files - they’re simple and work great for local development.