blob: 753537a34842026ec2e37703b4cf38986f0c23e5 [file] [log] [blame]
lombardoffb37bca2018-05-03 16:20:04 +02001"""
2Django settings for sf_t3d project.
3
4Generated by 'django-admin startproject' using Django 1.9.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/1.9/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/1.9/ref/settings/
11"""
12
13import os
14
15# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
18
19# Quick-start development settings - unsuitable for production
20# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = 'o5+o2jv(3-dqr(&ia#-@79cgr%xi*s+6xjws^8cxp211ge#buf'
lombardofrc89a4a02018-09-02 16:15:25 +020024if os.getenv('DJANGO_ENV') == 'prod':
25 DEBUG = False
26else:
27 DEBUG = True
28 print DEBUG
29ALLOWED_HOSTS = ['*']
lombardoffb37bca2018-05-03 16:20:04 +020030
lombardofr099364f2018-06-12 11:21:02 +020031AUTH_USER_MODEL = "authosm.OsmUser"
lombardoffb37bca2018-05-03 16:20:04 +020032
lombardof33848292018-05-08 10:12:14 +020033SITE_NAME = "Open Source MANO"
34SHORT_SITE_NAME = "OSM"
lombardoffb37bca2018-05-03 16:20:04 +020035
36LOGIN_URL = '/auth/'
37LOGOUT_URL = '/auth/'
38
39VERSION = "0.0.1"
40
41
42# Application definition
43INSTALLED_APPS = [
44 'django.contrib.admin',
45 'django.contrib.auth',
46 'django.contrib.contenttypes',
47 'django.contrib.messages',
48 'django.contrib.staticfiles',
lombardofr07930222018-06-19 16:59:45 +020049 'django.contrib.sessions',
lombardofr099364f2018-06-12 11:21:02 +020050 'authosm',
lombardoffb37bca2018-05-03 16:20:04 +020051 'projecthandler',
52 'vimhandler',
lombardofa03da5e2018-06-02 18:36:44 +020053 'instancehandler',
lombardofr099364f2018-06-12 11:21:02 +020054 'sdnctrlhandler',
lombardofr10b52d12018-07-17 23:42:28 +020055 'userhandler'
lombardofr099364f2018-06-12 11:21:02 +020056
lombardoffb37bca2018-05-03 16:20:04 +020057]
58
59MIDDLEWARE_CLASSES = [
60 'django.middleware.security.SecurityMiddleware',
61 'django.contrib.sessions.middleware.SessionMiddleware',
lombardofr99f922f2018-07-17 17:27:36 +020062 'projecthandler.middleware.OsmProjectMiddleware',
lombardoffb37bca2018-05-03 16:20:04 +020063 'django.middleware.common.CommonMiddleware',
64 'django.middleware.csrf.CsrfViewMiddleware',
65 'django.contrib.auth.middleware.AuthenticationMiddleware',
66 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
67 'django.contrib.messages.middleware.MessageMiddleware',
68 'django.middleware.clickjacking.XFrameOptionsMiddleware',
69
lombardofr99f922f2018-07-17 17:27:36 +020070
lombardoffb37bca2018-05-03 16:20:04 +020071]
72
lombardofr07930222018-06-19 16:59:45 +020073SESSION_ENGINE ='django.contrib.sessions.backends.db'
lombardoffb37bca2018-05-03 16:20:04 +020074SESSION_COOKIE_AGE = 3500 #25 min
75SESSION_EXPIRE_AT_BROWSER_CLOSE = True
76SESSION_SAVE_EVERY_REQUEST = True
77
78ROOT_URLCONF = 'sf_t3d.urls'
79
80TEMPLATES = [
81 {
82 'BACKEND': 'django.template.backends.django.DjangoTemplates',
83 'DIRS': [
84 os.path.join(BASE_DIR, 'template'),
85 os.path.join(BASE_DIR, 'projecthandler', 'template'),
86 os.path.join(BASE_DIR, 'projecthandler', 'template', 'download'),
87 os.path.join(BASE_DIR, 'projecthandler', 'template', 'project'),
88 os.path.join(BASE_DIR, 'vimhandler', 'template'),
89 os.path.join(BASE_DIR, 'instancehandler', 'template'),
lombardofa03da5e2018-06-02 18:36:44 +020090 os.path.join(BASE_DIR, 'sdnctrlhandler', 'template'),
lombardofr10b52d12018-07-17 23:42:28 +020091 os.path.join(BASE_DIR, 'userhandler', 'templates'),
lombardoffb37bca2018-05-03 16:20:04 +020092 ],
93 'APP_DIRS': True,
94 'OPTIONS': {
95 'context_processors': [
96 'django.template.context_processors.debug',
97 'django.template.context_processors.request',
98 'django.contrib.auth.context_processors.auth',
99 'django.contrib.messages.context_processors.messages',
100 'sf_t3d.context_processor.conf_constants',
101 ],
102 'libraries':{
103 'get': 'sf_t3d.templatetags.get',
lombardof74ed51a2018-05-11 01:07:01 +0200104 'date_tag': 'sf_t3d.templatetags.datetag',
lombardoffb37bca2018-05-03 16:20:04 +0200105 }
106 },
107 },
108]
109
110WSGI_APPLICATION = 'sf_t3d.wsgi.application'
111
112
113# Database
114# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
115
116DATABASES = {
117 'default': {
118 'ENGINE': 'django.db.backends.sqlite3',
119 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
120 }
121}
122
lombardofr099364f2018-06-12 11:21:02 +0200123AUTHENTICATION_BACKENDS = ['authosm.backend.OsmBackend']
124
lombardoffb37bca2018-05-03 16:20:04 +0200125
126# Password validation
127# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
128
129AUTH_PASSWORD_VALIDATORS = [
130 {
131 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
132 },
133 {
134 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
135 },
136 {
137 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
138 },
139 {
140 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
141 },
142]
143
144
145# Internationalization
146# https://docs.djangoproject.com/en/1.9/topics/i18n/
147
148LANGUAGE_CODE = 'en-us'
149
150TIME_ZONE = 'UTC'
151
152USE_I18N = True
153
154USE_L10N = True
155
156USE_TZ = True
157
158
159# Static files (CSS, JavaScript, Images)
160# https://docs.djangoproject.com/en/1.9/howto/static-files/
161
162STATIC_URL = '/static/'
lombardofrc89a4a02018-09-02 16:15:25 +0200163if DEBUG:
164 STATICFILES_FINDERS = (
165 'django.contrib.staticfiles.finders.FileSystemFinder',
166 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
167 'django.contrib.staticfiles.finders.DefaultStorageFinder'
168 )
169 STATICFILES_DIRS = (
170 # Put strings here, like "/home/html/static" or "C:/www/django/static".
171 # Always use forward slashes, even on Windows.
172 # Don't forget to use absolute paths, not relative paths.
173 os.path.join(BASE_DIR, "static"),
174 )
175else:
176 STATIC_ROOT = os.path.join(BASE_DIR, "static/")
lombardoffb37bca2018-05-03 16:20:04 +0200177
178LOCALE_PATHS = (
179 os.path.join(BASE_DIR, 'locale'),
lombardofrc89a4a02018-09-02 16:15:25 +0200180)