refactoring settings.py to better get environment variables