|
| 1 | +""" |
| 2 | +Django settings for pydsa project. |
| 3 | +
|
| 4 | +Generated by 'django-admin startproject' using Django 1.8.2. |
| 5 | +
|
| 6 | +For more information on this file, see |
| 7 | +https://docs.djangoproject.com/en/1.8/topics/settings/ |
| 8 | +
|
| 9 | +For the full list of settings and their values, see |
| 10 | +https://docs.djangoproject.com/en/1.8/ref/settings/ |
| 11 | +""" |
| 12 | + |
| 13 | +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) |
| 14 | +import os |
| 15 | +import environ |
| 16 | + |
| 17 | + |
| 18 | +root = environ.Path(__file__) - 3 # three folder back (/a/b/c/ - 3 = /) |
| 19 | +env = environ.Env(DEBUG=(bool, False),) # set default values and casting |
| 20 | +environ.Env.read_env() # reading .env file |
| 21 | + |
| 22 | +SITE_ROOT = root() |
| 23 | +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 24 | + |
| 25 | +# Quick-start development settings - unsuitable for production |
| 26 | +# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ |
| 27 | + |
| 28 | +# SECURITY WARNING: keep the secret key used in production secret! |
| 29 | +SECRET_KEY = env('SECRET_KEY') |
| 30 | + |
| 31 | +# SECURITY WARNING: don't run with debug turned on in production! |
| 32 | +DEBUG = env('DEBUG') # False if not in os.environ |
| 33 | + |
| 34 | +ALLOWED_HOSTS = [] |
| 35 | + |
| 36 | + |
| 37 | +# Application definition |
| 38 | + |
| 39 | +INSTALLED_APPS = ( |
| 40 | + 'django.contrib.admin', |
| 41 | + 'django.contrib.auth', |
| 42 | + 'django.contrib.contenttypes', |
| 43 | + 'django.contrib.sessions', |
| 44 | + 'django.contrib.messages', |
| 45 | + 'django.contrib.staticfiles', |
| 46 | + 'sort', |
| 47 | +) |
| 48 | + |
| 49 | +MIDDLEWARE_CLASSES = ( |
| 50 | + 'django.contrib.sessions.middleware.SessionMiddleware', |
| 51 | + 'django.middleware.common.CommonMiddleware', |
| 52 | + 'django.middleware.csrf.CsrfViewMiddleware', |
| 53 | + 'django.contrib.auth.middleware.AuthenticationMiddleware', |
| 54 | + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', |
| 55 | + 'django.contrib.messages.middleware.MessageMiddleware', |
| 56 | + 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
| 57 | + 'django.middleware.security.SecurityMiddleware', |
| 58 | +) |
| 59 | + |
| 60 | +ROOT_URLCONF = 'pydsa.urls' |
| 61 | + |
| 62 | +TEMPLATES = [ |
| 63 | + { |
| 64 | + 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
| 65 | + 'DIRS': [os.path.join(BASE_DIR, 'templates')], |
| 66 | + 'APP_DIRS': True, |
| 67 | + 'OPTIONS': { |
| 68 | + 'context_processors': [ |
| 69 | + 'django.template.context_processors.debug', |
| 70 | + 'django.template.context_processors.request', |
| 71 | + 'django.contrib.auth.context_processors.auth', |
| 72 | + 'django.contrib.messages.context_processors.messages', |
| 73 | + ], |
| 74 | + }, |
| 75 | + }, |
| 76 | +] |
| 77 | + |
| 78 | +WSGI_APPLICATION = 'pydsa.wsgi.application' |
| 79 | + |
| 80 | + |
| 81 | +# Database |
| 82 | +# https://docs.djangoproject.com/en/1.8/ref/settings/#databases |
| 83 | +DATABASES = { |
| 84 | + # Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ |
| 85 | + 'default': env.db(), |
| 86 | + 'extra': env.db('SQLITE_URL', default='sqlite:////tmp/my-tmp-sqlite.db') |
| 87 | +} |
| 88 | + |
| 89 | + |
| 90 | +# Internationalization |
| 91 | +# https://docs.djangoproject.com/en/1.8/topics/i18n/ |
| 92 | + |
| 93 | +LANGUAGE_CODE = 'en-us' |
| 94 | + |
| 95 | +TIME_ZONE = 'UTC' |
| 96 | + |
| 97 | +USE_I18N = True |
| 98 | + |
| 99 | +USE_L10N = True |
| 100 | + |
| 101 | +USE_TZ = True |
| 102 | + |
| 103 | + |
| 104 | +# Static files (CSS, JavaScript, Images) |
| 105 | +# https://docs.djangoproject.com/en/1.8/howto/static-files/ |
| 106 | + |
| 107 | +STATIC_ROOT = os.path.join(BASE_DIR, 'sort/static') |
| 108 | +STATIC_URL = '/static/' |
| 109 | +STATICFILES_DIRS = ( |
| 110 | + os.path.join(BASE_DIR, 'staticfiles'), |
| 111 | +) |
| 112 | +STATICFILES_FINDERS = ( |
| 113 | + 'django.contrib.staticfiles.finders.FileSystemFinder', |
| 114 | + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', |
| 115 | +) |
0 commit comments