· 7 years ago · Apr 09, 2018, 11:52 AM
1'''
2Django settings for itapp project.
3
4For more information on this file, see
5https://docs.djangoproject.com/en/dev/topics/settings/
6
7For the full list of settings and their values, see
8https://docs.djangoproject.com/en/dev/ref/settings/
9'''
10
11# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
12import os
13import ldap
14
15BASE_DIR = os.path.dirname(os.path.dirname(__file__))
16
17# Quick-start development settings - unsuitable for production
18# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/
19
20# SECURITY WARNING: keep the secret key used in production secret!
21SECRET_KEY = ***********
22
23# SECURITY WARNING: don't run with debug turned on in production!
24DEBUG = False
25
26ALLOWED_HOSTS = ['*']
27
28# Application definition
29
30INSTALLED_APPS = (
31 'django.contrib.admin',
32 'django.contrib.auth',
33 'django.contrib.contenttypes',
34 'django.contrib.sessions',
35 'django.contrib.messages',
36 'django.contrib.staticfiles',
37 'django.contrib.humanize',
38 'home.apps.HomeConfig',
39 'oncall.apps.OncallConfig',
40 'tools.apps.ToolsConfig',
41 'sites.apps.SitesConfig',
42 'maintenance.apps.MaintenanceConfig',
43 'service.apps.ServiceConfig',
44 'monitoring.apps.MonitoringConfig',
45 'mgmt.apps.MgmtConfig',
46 'config.apps.ConfigConfig',
47 'circuits.apps.CircuitsConfig',
48 'storages',
49 'imagekit',
50 'django_celery_results',
51 'debug_toolbar',
52 'simple_history',
53 'crispy_forms',
54)
55
56MIDDLEWARE = [
57 'django.contrib.sessions.middleware.SessionMiddleware',
58 'django.middleware.common.CommonMiddleware',
59 'django.middleware.csrf.CsrfViewMiddleware',
60 'django.contrib.auth.middleware.AuthenticationMiddleware',
61 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
62 'django.contrib.messages.middleware.MessageMiddleware',
63 'debug_toolbar.middleware.DebugToolbarMiddleware',
64 'simple_history.middleware.HistoryRequestMiddleware',
65]
66
67ROOT_URLCONF = 'itapp.urls'
68
69TEMPLATES = [
70 {
71 'BACKEND': 'django.template.backends.django.DjangoTemplates',
72 'DIRS': [
73 BASE_DIR + '/templates/',
74 ],
75 'APP_DIRS': True,
76 'OPTIONS': {
77 'debug' : DEBUG,
78 'context_processors': [
79 'django.template.context_processors.debug',
80 'django.contrib.auth.context_processors.auth',
81 'django.contrib.messages.context_processors.messages',
82 'django.template.context_processors.media',
83 'django.template.context_processors.static',
84 'itapp.context_processors.SiteLinks',
85 'itapp.context_processors.QuickJumpLinks',
86 ],
87 },
88 },
89]
90CRISPY_TEMPLATE_PACK = 'bootstrap3'
91WSGI_APPLICATION = 'itapp.wsgi.application'
92
93# Database
94# https://docs.djangoproject.com/en/dev/ref/settings/#databases
95
96DATABASES = {
97 'default': {
98 'ENGINE': 'django.db.backends.mysql',
99 'OPTIONS': {
100 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
101 },
102 'NAME': 'it_app_db_v2',
103 'USER': '*****',
104 'PASSWORD': '*****',
105 'HOST': '****',
106 'PORT': '3306',
107 }
108}
109
110# Password validation
111# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
112
113AUTH_PASSWORD_VALIDATORS = [
114 {
115 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
116 },
117 {
118 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
119 },
120 {
121 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
122 },
123 {
124 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
125 },
126]
127
128INTERNAL_IPS = ('127.0.0.1',)
129
130def show_toolbar(request):
131 return True
132
133DEBUG_TOOLBAR_CONFIG = {
134 "SHOW_TOOLBAR_CALLBACK" : show_toolbar,
135}
136
137# Internationalization
138# https://docs.djangoproject.com/en/dev/topics/i18n/
139
140LANGUAGE_CODE = 'en-gb'
141
142TIME_ZONE = 'Europe/London'
143
144USE_I18N = True
145
146USE_L10N = True
147
148USE_TZ = False