def test_env_string_with_required(): """ Test that when the environment variable is missing and a default is provided, the default is retured. """ assert 'TEST_BOOLEAN_ENV_VARIABLE' not in os.environ with pytest.raises(KeyError): env_string('TEST_BOOLEAN_ENV_VARIABLE', required=True)
def test_env_string_with_basic_usage(monkeypatch): """ Test that when the environment variable is present that it is returned as a string. """ monkeypatch.setenv('TEST_BOOLEAN_ENV_VARIABLE', 'test-value') actual = env_string('TEST_BOOLEAN_ENV_VARIABLE') assert actual == 'test-value'
def test_env_string_with_default_value(monkeypatch): """ Test that when the environment variable is missing and a default is provided, the default is retured. """ assert 'TEST_BOOLEAN_ENV_VARIABLE' not in os.environ actual = env_string('TEST_BOOLEAN_ENV_VARIABLE', default='test-value') assert actual == 'test-value'
def test_env_string_with_default_value(monkeypatch): """ Test that when the environment variable is missing and a default is provided, the default is retured. """ assert 'TEST_BOOLEAN_ENV_VARIABLE' not in os.environ actual = env_string('TEST_BOOLEAN_ENV_VARIABLE', 'test-value') assert actual == 'test-value'
SITE_ID = 1 def upath(path): """ Always return a unicode path. """ if not six.PY3: fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding() return path.decode(fs_encoding) return path RUNTESTS_DIR = os.path.dirname(upath(__file__)) TEST_TEMPLATE_DIR = 'templates' TEMP_DIR = excavator.env_string('DJANGO_TEST_TEMP_DIR', required=True) ROOT_URLCONF = 'urls' STATIC_URL = '/static/' STATIC_ROOT = os.path.join(TEMP_DIR, 'static') MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(TEMP_DIR, 'media') TEMPLATE_DIRS = (os.path.join(RUNTESTS_DIR, TEST_TEMPLATE_DIR),) USE_I18N = True LANGUAGE_CODE = 'en' LOGIN_URL = 'django.contrib.auth.views.login' STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'compressor.finders.CompressorFinder',
def test_env_string_with_required_and_default_is_error(): with pytest.raises(ValueError): env_string('TEST_BOOLEAN_ENV_VARIABLE', required=True, default='test-value')
import os import excavator import dj_database_url import django_cache_url # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = excavator.env_string('DJANGO_SECRET_KEY', required=True) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = excavator.env_bool('DJANGO_DEBUG', default=True) TEMPLATE_DEBUG = DEBUG # Template Locations # https://docs.djangoproject.com/en/1.7/ref/settings/#template-dirs TEMPLATE_DIRS = ( os.path.join(BASE_DIR, 'mozy', 'templates'), ) TEMPLATE_CONTEXT_PROCESSORS = ( 'django.contrib.auth.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n',
import os import excavator import dj_database_url import django_cache_url # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = excavator.env_string('DJANGO_SECRET_KEY', required=True) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = excavator.env_bool('DJANGO_DEBUG', default=True) TEMPLATE_DEBUG = DEBUG # Template Locations # https://docs.djangoproject.com/en/1.7/ref/settings/#template-dirs TEMPLATE_DIRS = ( os.path.join(BASE_DIR, '{{ cookiecutter.app_name }}', 'templates'), ) TEMPLATE_CONTEXT_PROCESSORS = ( 'django.contrib.auth.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n',
For more information on this file, see https://docs.djangoproject.com/en/dev/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/dev/ref/settings/ """ import os import excavator import dj_database_url import django_cache_url # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = excavator.env_string('DJANGO_SECRET_KEY', required=True) ADMINS = ( ('Piper', '*****@*****.**'), ) DEFAULT_FROM_EMAIL = excavator.env_string( 'DJANGO_DEFAULT_FROM_EMAIL', default='*****@*****.**', ) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = excavator.env_bool('DJANGO_DEBUG', default=False) TEMPLATE_DEBUG = DEBUG
""" # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os import excavator from dj_database_url import config as dj_config BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = excavator.env_string('DJANGO_SECRET_KEY', required=True) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = excavator.env_bool('DJANGO_DEBUG', required=True) ALLOWED_HOSTS = excavator.env_list("DJANGO_ALLOWED_HOSTS", required=True) TEMPLATE_DEBUG = DEBUG # Application definition INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes',
def upath(path): """ Always return a unicode path. """ if not six.PY3: fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding() return path.decode(fs_encoding) return path RUNTESTS_DIR = os.path.dirname(upath(__file__)) TEST_TEMPLATE_DIR = 'templates' TEMP_DIR = excavator.env_string('DJANGO_TEST_TEMP_DIR', required=True) ROOT_URLCONF = 'urls' STATIC_URL = '/static/' STATIC_ROOT = os.path.join(TEMP_DIR, 'static') MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(TEMP_DIR, 'media') TEMPLATE_DIRS = (os.path.join(RUNTESTS_DIR, TEST_TEMPLATE_DIR), ) USE_I18N = True LANGUAGE_CODE = 'en' LOGIN_URL = 'django.contrib.auth.views.login' STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'compressor.finders.CompressorFinder',
import os import excavator import dj_database_url import django_cache_url # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = excavator.env_string('DJANGO_SECRET_KEY', required=True) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = excavator.env_bool('DJANGO_DEBUG', default=True) TEMPLATE_DEBUG = DEBUG # Template Locations # https://docs.djangoproject.com/en/1.7/ref/settings/#template-dirs TEMPLATE_DIRS = (os.path.join(BASE_DIR, '{{ cookiecutter.app_name }}', 'templates'), ) TEMPLATE_CONTEXT_PROCESSORS = ( 'django.contrib.auth.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n', 'django.core.context_processors.media', 'django.core.context_processors.static', 'django.core.context_processors.tz',
""" Django settings for {{ cookiecutter.app_name }} project. """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os import excavator import dj_database_url import django_cache_url BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = excavator.env_string('DJANGO_SECRET_KEY', required=True) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = excavator.env_bool('DJANGO_DEBUG', default=False) TEMPLATE_DEBUG = True ALLOWED_HOSTS = excavator.env_list('DJANGO_ALLOWED_HOSTS', '') # Application definition INSTALLED_APPS = ( 'rest_framework', '{{ cookiecutter.app_name }}', )
For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) import excavator from dj_database_url import config as dj_config # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = excavator.env_string('DJANGO_SECRET_KEY', required=True) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = excavator.env_bool('DJANGO_DEBUG', required=True) TEMPLATE_DEBUG = DEBUG ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions',