Why does Django use a settings.py file for configuration, and what are the trade-offs of using environment variables versus hardcoded settings?
Last updated
A Python
settings.pygives one canonical, importable config location where you can compute paths and branch with real code.Environment variables keep secrets out of git and vary per environment, but must be managed externally and are untyped strings. Hardcoding is simple but leaks secrets and can't vary by environment.
Common pattern: read sensitive values (
SECRET_KEY,DEBUG) viaos.environordjango-environand keep non-secret defaults in the file.
- https://www.interviewbit.com/django-interview-questions/
- https://www.scribd.com/document/911648753/Headout-Backend-Engineering-Interview-Questions-Bank-CLAUDE
- https://www.uplers.com/
- https://medium.com/@anas-issath/the-django-career-guide-from-junior-to-senior-fea1c3e52aa6
- https://www.quora.com/What-are-some-interview-questions-asked-or-can-be-asked-related-to-Django-and-Python
- https://www.reddit.com/r/developersIndia/
- https://internshala.com/blog/infosys-python-interview-questions/