def check_user_is_admin(user): # This is commented just for DEBUG: # All users are granted 'admin' rights if env.get('DJANGO_DEBUG_TOOLBAR_ENABLED', type=bool, default=True): return True return user.is_authenticated() and user.is_admin
def test_get_mapping_for_iso8601(type, expected): actual = get('ENV_VARIABLE', default=expected, type=type) assert actual == expected
def test_get_mapping_for_lists(type, default, expected): actual = get('ENV_VARIABLE', default=default, type=type) assert actual == expected
For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ import os import excavator as env import dj_database_url # 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.10/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = env.get('DJANGO_SECRET_KEY', required=True) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.get('DJANGO_DEBUG', type=bool) ALLOWED_HOSTS = env.get('DJANGO_ALLOWED_HOSTS', type=list, required=not DEBUG) SECURE_SSL_REDIRECT = env.get( 'DJANGO_SECURE_SSL_REDIRECT', type=bool, default=True, ) # Application definition INSTALLED_APPS = [
import os import excavator as env 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 = env.get('DJANGO_SECRET_KEY', required=True) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.get('DJANGO_DEBUG', type=bool, 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, 'eth_computation_market', 'templates'), ) TEMPLATE_CONTEXT_PROCESSORS = ( 'django.contrib.auth.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n',
import os import urllib.parse import dj_database_url import excavator as env # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) APP_DIR = 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 = env.get('DJANGO_SECRET_KEY', required=True) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.get('DJANGO_DEBUG', type=bool, default=False) ALLOWED_HOSTS = env.get('DJANGO_ALLOWED_HOSTS', type=list, required=not DEBUG) SECURE_SSL_REDIRECT = env.get('DJANGO_SECURE_SSL_REDIRECT', type=bool, default=True) # Application definition INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages',
import os import excavator as env import dotenv BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) dotenv.load_dotenv(os.path.join(BASE_DIR, '.env')) # Local overrides (not tracked) dotenv.load_dotenv(os.path.join(BASE_DIR, '.env_defaults')) # Development defaults (tracked) SECRET_KEY = env.get('DJANGO_SECRET_KEY', required=True) DEBUG = env.get('DJANGO_DEBUG', type=bool, default=False) DEBUG_ETH_USER_INIT_BALANCE = env.get('DEBUG_ETH_USER_INIT_BALANCE', type=float, default=10.0) ALLOWED_HOSTS = [] INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.admin', 'django.contrib.sites', 'django.contrib.staticfiles', 'django.contrib.humanize', # 3rd party 'corsheaders', 'authtools', 'rest_framework', 'argonauts', 'storages',
import os import urllib.parse import dj_database_url import excavator as env # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) APP_DIR = 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 = env.get('DJANGO_SECRET_KEY', required=True) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.get('DJANGO_DEBUG', type=bool, default=False) ALLOWED_HOSTS = env.get('DJANGO_ALLOWED_HOSTS', type=list, required=not DEBUG) SECURE_SSL_REDIRECT = env.get('DJANGO_SECURE_SSL_REDIRECT', type=bool, default=True) # Application definition INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes',