blob: aae8b5ec8e759e35d8679304921ccf84320eb886 [file] [log] [blame]
lombardofr3218b2b2018-10-29 13:41:08 +01001#
2# Copyright 2018 EveryUP Srl
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
lombardoffb37bca2018-05-03 16:20:04 +020016
17import os
18
19# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
20BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
21
22
23# Quick-start development settings - unsuitable for production
24# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
25
26# SECURITY WARNING: keep the secret key used in production secret!
27SECRET_KEY = 'o5+o2jv(3-dqr(&ia#-@79cgr%xi*s+6xjws^8cxp211ge#buf'
lombardofrc89a4a02018-09-02 16:15:25 +020028if os.getenv('DJANGO_ENV') == 'prod':
29 DEBUG = False
30else:
31 DEBUG = True
32 print DEBUG
33ALLOWED_HOSTS = ['*']
lombardoffb37bca2018-05-03 16:20:04 +020034
lombardofr099364f2018-06-12 11:21:02 +020035AUTH_USER_MODEL = "authosm.OsmUser"
lombardoffb37bca2018-05-03 16:20:04 +020036
lombardof33848292018-05-08 10:12:14 +020037SITE_NAME = "Open Source MANO"
38SHORT_SITE_NAME = "OSM"
lombardoffb37bca2018-05-03 16:20:04 +020039
40LOGIN_URL = '/auth/'
41LOGOUT_URL = '/auth/'
42
43VERSION = "0.0.1"
44
45
46# Application definition
47INSTALLED_APPS = [
48 'django.contrib.admin',
49 'django.contrib.auth',
50 'django.contrib.contenttypes',
51 'django.contrib.messages',
52 'django.contrib.staticfiles',
lombardofr07930222018-06-19 16:59:45 +020053 'django.contrib.sessions',
lombardofr099364f2018-06-12 11:21:02 +020054 'authosm',
lombardoffb37bca2018-05-03 16:20:04 +020055 'projecthandler',
lombardofre1ed7b22018-12-19 17:27:24 +010056 'packagehandler',
lombardofr3218b2b2018-10-29 13:41:08 +010057 'descriptorhandler',
lombardoffb37bca2018-05-03 16:20:04 +020058 'vimhandler',
lombardofa03da5e2018-06-02 18:36:44 +020059 'instancehandler',
lombardofr099364f2018-06-12 11:21:02 +020060 'sdnctrlhandler',
lombardofr10b52d12018-07-17 23:42:28 +020061 'userhandler'
lombardofr099364f2018-06-12 11:21:02 +020062
lombardoffb37bca2018-05-03 16:20:04 +020063]
64
65MIDDLEWARE_CLASSES = [
66 'django.middleware.security.SecurityMiddleware',
67 'django.contrib.sessions.middleware.SessionMiddleware',
lombardofr99f922f2018-07-17 17:27:36 +020068 'projecthandler.middleware.OsmProjectMiddleware',
lombardoffb37bca2018-05-03 16:20:04 +020069 'django.middleware.common.CommonMiddleware',
70 'django.middleware.csrf.CsrfViewMiddleware',
71 'django.contrib.auth.middleware.AuthenticationMiddleware',
72 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
73 'django.contrib.messages.middleware.MessageMiddleware',
74 'django.middleware.clickjacking.XFrameOptionsMiddleware',
75
lombardofr99f922f2018-07-17 17:27:36 +020076
lombardoffb37bca2018-05-03 16:20:04 +020077]
78
lombardofr07930222018-06-19 16:59:45 +020079SESSION_ENGINE ='django.contrib.sessions.backends.db'
lombardoffb37bca2018-05-03 16:20:04 +020080SESSION_COOKIE_AGE = 3500 #25 min
81SESSION_EXPIRE_AT_BROWSER_CLOSE = True
82SESSION_SAVE_EVERY_REQUEST = True
83
84ROOT_URLCONF = 'sf_t3d.urls'
85
86TEMPLATES = [
87 {
88 'BACKEND': 'django.template.backends.django.DjangoTemplates',
89 'DIRS': [
90 os.path.join(BASE_DIR, 'template'),
91 os.path.join(BASE_DIR, 'projecthandler', 'template'),
92 os.path.join(BASE_DIR, 'projecthandler', 'template', 'download'),
93 os.path.join(BASE_DIR, 'projecthandler', 'template', 'project'),
lombardofre1ed7b22018-12-19 17:27:24 +010094 os.path.join(BASE_DIR, 'packagehandler', 'template'),
lombardofr3218b2b2018-10-29 13:41:08 +010095 os.path.join(BASE_DIR, 'descriptorhandler', 'template'),
lombardoffb37bca2018-05-03 16:20:04 +020096 os.path.join(BASE_DIR, 'vimhandler', 'template'),
97 os.path.join(BASE_DIR, 'instancehandler', 'template'),
lombardofa03da5e2018-06-02 18:36:44 +020098 os.path.join(BASE_DIR, 'sdnctrlhandler', 'template'),
lombardofr10b52d12018-07-17 23:42:28 +020099 os.path.join(BASE_DIR, 'userhandler', 'templates'),
lombardoffb37bca2018-05-03 16:20:04 +0200100 ],
101 'APP_DIRS': True,
102 'OPTIONS': {
103 'context_processors': [
104 'django.template.context_processors.debug',
105 'django.template.context_processors.request',
106 'django.contrib.auth.context_processors.auth',
107 'django.contrib.messages.context_processors.messages',
108 'sf_t3d.context_processor.conf_constants',
109 ],
110 'libraries':{
111 'get': 'sf_t3d.templatetags.get',
lombardof74ed51a2018-05-11 01:07:01 +0200112 'date_tag': 'sf_t3d.templatetags.datetag',
lombardoffb37bca2018-05-03 16:20:04 +0200113 }
114 },
115 },
116]
117
118WSGI_APPLICATION = 'sf_t3d.wsgi.application'
119
120
121# Database
122# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
123
124DATABASES = {
125 'default': {
126 'ENGINE': 'django.db.backends.sqlite3',
127 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
128 }
129}
130
lombardofr099364f2018-06-12 11:21:02 +0200131AUTHENTICATION_BACKENDS = ['authosm.backend.OsmBackend']
132
lombardoffb37bca2018-05-03 16:20:04 +0200133
134# Password validation
135# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
136
137AUTH_PASSWORD_VALIDATORS = [
138 {
139 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
140 },
141 {
142 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
143 },
144 {
145 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
146 },
147 {
148 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
149 },
150]
151
152
153# Internationalization
154# https://docs.djangoproject.com/en/1.9/topics/i18n/
155
156LANGUAGE_CODE = 'en-us'
157
158TIME_ZONE = 'UTC'
159
160USE_I18N = True
161
162USE_L10N = True
163
164USE_TZ = True
165
166
167# Static files (CSS, JavaScript, Images)
168# https://docs.djangoproject.com/en/1.9/howto/static-files/
169
170STATIC_URL = '/static/'
lombardofrc89a4a02018-09-02 16:15:25 +0200171if DEBUG:
172 STATICFILES_FINDERS = (
173 'django.contrib.staticfiles.finders.FileSystemFinder',
174 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
175 'django.contrib.staticfiles.finders.DefaultStorageFinder'
176 )
177 STATICFILES_DIRS = (
178 # Put strings here, like "/home/html/static" or "C:/www/django/static".
179 # Always use forward slashes, even on Windows.
180 # Don't forget to use absolute paths, not relative paths.
181 os.path.join(BASE_DIR, "static"),
182 )
183else:
184 STATIC_ROOT = os.path.join(BASE_DIR, "static/")
lombardoffb37bca2018-05-03 16:20:04 +0200185
186LOCALE_PATHS = (
187 os.path.join(BASE_DIR, 'locale'),
lombardofrc89a4a02018-09-02 16:15:25 +0200188)