· 9 years ago · Sep 01, 2016, 04:54 AM
1"""
2Django settings for mech tracker project, on Heroku. For more info, see:
3https://github.com/heroku/heroku-django-template
4
5For more information on this file, see
6https://docs.djangoproject.com/en/1.8/topics/settings/
7
8For the full list of settings and their values, see
9https://docs.djangoproject.com/en/1.8/ref/settings/
10"""
11
12import os
13import dj_database_url
14
15
16# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
17BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
18
19
20# Quick-start development settings - unsuitable for production
21# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
22
23# SECURITY WARNING: change this before deploying to production!
24SECRET_KEY = 'i+acxn5(akgsn!sr4^qgf(^m&*@+g1@u^t@=8s@axc41ml*f=s'
25
26# SECURITY WARNING: don't run with debug turned on in production!
27DEBUG = True
28
29
30# Application definition
31
32INSTALLED_APPS = (
33 'django.contrib.admin',
34 'django.contrib.auth',
35 'django.contrib.contenttypes',
36 'django.contrib.sessions',
37 'django.contrib.messages',
38 'django.contrib.staticfiles',
39 'tracker'
40)
41
42MIDDLEWARE_CLASSES = (
43 'django.contrib.sessions.middleware.SessionMiddleware',
44 'django.middleware.common.CommonMiddleware',
45 'django.middleware.csrf.CsrfViewMiddleware',
46 'django.contrib.auth.middleware.AuthenticationMiddleware',
47 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
48 'django.contrib.messages.middleware.MessageMiddleware',
49 'django.middleware.clickjacking.XFrameOptionsMiddleware',
50 'django.middleware.security.SecurityMiddleware',
51)
52
53ROOT_URLCONF = 'core.urls'
54
55TEMPLATES = [
56 {
57 'BACKEND': 'django.template.backends.django.DjangoTemplates',
58 'DIRS': [os.path.join(BASE_DIR,'templates')],
59 'APP_DIRS': True,
60 'OPTIONS': {
61 'context_processors': [
62 'django.template.context_processors.debug',
63 'django.template.context_processors.request',
64 'django.contrib.auth.context_processors.auth',
65 'django.contrib.messages.context_processors.messages',
66 ],
67 },
68 },
69]
70
71WSGI_APPLICATION = 'core.wsgi.application'
72
73
74# Database
75# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
76
77DATABASES = {
78 'default': {
79 'ENGINE': 'django.db.backends.sqlite3',
80 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
81 }
82}
83
84# Password validation
85# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
86
87AUTH_PASSWORD_VALIDATORS = [
88 {
89 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
90 },
91 {
92 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
93 },
94 {
95 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
96 },
97 {
98 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
99 },
100]
101
102# Internationalization
103# https://docs.djangoproject.com/en/1.8/topics/i18n/
104
105LANGUAGE_CODE = 'en-us'
106TIME_ZONE = 'UTC'
107USE_I18N = True
108USE_L10N = True
109USE_TZ = True
110
111
112# Update database configuration with $DATABASE_URL.
113db_from_env = dj_database_url.config(conn_max_age=500)
114DATABASES['default'].update(db_from_env)
115
116# Honor the 'X-Forwarded-Proto' header for request.is_secure()
117SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
118
119# Allow all host headers
120ALLOWED_HOSTS = ['*']
121
122# Static files (CSS, JavaScript, Images)
123# https://docs.djangoproject.com/en/1.8/howto/static-files/
124
125STATIC_URL = '/static/'
126STATIC_ROOT = os.path.join(BASE_DIR, 'static')
127
128STATICFILES_DIRS = (
129 os.path.join(BASE_DIR, STATIC_URL),
130)
131
132
133# Simplified static file serving.
134# https://warehouse.python.org/project/whitenoise/
135STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'