def test_load_in_osenviron(self): """Ensure that the new values are placed into the environment""" load(self.env_file) self.assertTrue('SYSENV_DEBUG_VALUE_' in os.environ)
def test_activate_sys(self): """Ensure that the Env is activated using the environment""" env = load() self.assertEqual('Okay', env['SYSENV_TESTING_VALUE_'])
def test_load_file(self): env = load(self.env_file) self.assertTrue(env.get('SYSENV_DEBUG_VALUE_', False, cast=bool)) self.assertEqual(0, env.get('BOOL_FALSE_VAR', 9, cast=int)) self.assertFalse(env.get('BOOL_FALSE_VAR', True, cast=bool))
import os import dj_database_url import sysenv env = sysenv.load() DEBUG = env.get('DEBUG', False) TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', '*****@*****.**'), ) settings_dir = os.path.dirname(__file__) PROJECT_ROOT = os.path.abspath(os.path.dirname(settings_dir)) MANAGERS = ADMINS DATABASES = {'default': dj_database_url.config()} # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # In a Windows environment this must be set to your system time zone. TIME_ZONE = 'America/New_York' # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'en-us' SITE_ID = 1
import os import dj_database_url import sysenv env = sysenv.load() # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '%@hc%qp+&gi5f%^h(9bcm=&brps!j^s%da9u@ff59^p0ngbrn=' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.get('DEBUG', True, cast=bool) ALLOWED_HOSTS = ['*'] # Application definition INSTALLED_APPS = [ 'peak', 'blog', 'taggit', 'django_markwhat', 'allauth', 'allauth.account',