Skip to content

Instantly share code, notes, and snippets.

@ferhatelmas
Last active December 16, 2015 05:59
Show Gist options
  • Save ferhatelmas/5388081 to your computer and use it in GitHub Desktop.
Save ferhatelmas/5388081 to your computer and use it in GitHub Desktop.
Usage of environment variables to show a better way of handling settings in django
import os
exec("from .{0} import *".format(os.environ.get("NAR_ENVIRONMENT", "dev")))
import os
some_configuration_value = os.environ.get('some_configuration_key', 'default_value')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment