Network Slice Templates
[osm/LW-UI.git] / sf_t3d / settings.py
1 #
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 #
16
17 import os
18
19 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
20 BASE_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!
27 SECRET_KEY = 'o5+o2jv(3-dqr(&ia#-@79cgr%xi*s+6xjws^8cxp211ge#buf'
28 if os.getenv('DJANGO_ENV') == 'prod':
29 DEBUG = False
30 else:
31 DEBUG = True
32 print DEBUG
33 ALLOWED_HOSTS = ['*']
34
35 AUTH_USER_MODEL = "authosm.OsmUser"
36
37 SITE_NAME = "Open Source MANO"
38 SHORT_SITE_NAME = "OSM"
39
40 LOGIN_URL = '/auth/'
41 LOGOUT_URL = '/auth/'
42
43 VERSION = "0.0.1"
44
45
46 # Application definition
47 INSTALLED_APPS = [
48 'django.contrib.admin',
49 'django.contrib.auth',
50 'django.contrib.contenttypes',
51 'django.contrib.messages',
52 'django.contrib.staticfiles',
53 'django.contrib.sessions',
54 'authosm',
55 'projecthandler',
56 'packagehandler',
57 'descriptorhandler',
58 'vimhandler',
59 'instancehandler',
60 'sdnctrlhandler',
61 'userhandler',
62 'netslicehandler'
63
64 ]
65
66 MIDDLEWARE_CLASSES = [
67 'django.middleware.security.SecurityMiddleware',
68 'django.contrib.sessions.middleware.SessionMiddleware',
69 'projecthandler.middleware.OsmProjectMiddleware',
70 'django.middleware.common.CommonMiddleware',
71 'django.middleware.csrf.CsrfViewMiddleware',
72 'django.contrib.auth.middleware.AuthenticationMiddleware',
73 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
74 'django.contrib.messages.middleware.MessageMiddleware',
75 'django.middleware.clickjacking.XFrameOptionsMiddleware',
76
77
78 ]
79
80 SESSION_ENGINE ='django.contrib.sessions.backends.db'
81 SESSION_COOKIE_AGE = 3500 #25 min
82 SESSION_EXPIRE_AT_BROWSER_CLOSE = True
83 SESSION_SAVE_EVERY_REQUEST = True
84
85 ROOT_URLCONF = 'sf_t3d.urls'
86
87 TEMPLATES = [
88 {
89 'BACKEND': 'django.template.backends.django.DjangoTemplates',
90 'DIRS': [
91 os.path.join(BASE_DIR, 'template'),
92 os.path.join(BASE_DIR, 'projecthandler', 'template'),
93 os.path.join(BASE_DIR, 'projecthandler', 'template', 'download'),
94 os.path.join(BASE_DIR, 'projecthandler', 'template', 'project'),
95 os.path.join(BASE_DIR, 'packagehandler', 'template'),
96 os.path.join(BASE_DIR, 'descriptorhandler', 'template'),
97 os.path.join(BASE_DIR, 'vimhandler', 'template'),
98 os.path.join(BASE_DIR, 'instancehandler', 'template'),
99 os.path.join(BASE_DIR, 'sdnctrlhandler', 'template'),
100 os.path.join(BASE_DIR, 'userhandler', 'templates'),
101 os.path.join(BASE_DIR, 'netslicehandler', 'template'),
102 ],
103 'APP_DIRS': True,
104 'OPTIONS': {
105 'context_processors': [
106 'django.template.context_processors.debug',
107 'django.template.context_processors.request',
108 'django.contrib.auth.context_processors.auth',
109 'django.contrib.messages.context_processors.messages',
110 'sf_t3d.context_processor.conf_constants',
111 ],
112 'libraries':{
113 'get': 'sf_t3d.templatetags.get',
114 'date_tag': 'sf_t3d.templatetags.datetag',
115 }
116 },
117 },
118 ]
119
120 WSGI_APPLICATION = 'sf_t3d.wsgi.application'
121
122
123 # Database
124 # https://docs.djangoproject.com/en/1.9/ref/settings/#databases
125
126 DATABASES = {
127 'default': {
128 'ENGINE': 'django.db.backends.sqlite3',
129 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
130 }
131 }
132
133 AUTHENTICATION_BACKENDS = ['authosm.backend.OsmBackend']
134
135
136 # Password validation
137 # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
138
139 AUTH_PASSWORD_VALIDATORS = [
140 {
141 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
142 },
143 {
144 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
145 },
146 {
147 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
148 },
149 {
150 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
151 },
152 ]
153
154
155 # Internationalization
156 # https://docs.djangoproject.com/en/1.9/topics/i18n/
157
158 LANGUAGE_CODE = 'en-us'
159
160 TIME_ZONE = 'UTC'
161
162 USE_I18N = True
163
164 USE_L10N = True
165
166 USE_TZ = True
167
168
169 # Static files (CSS, JavaScript, Images)
170 # https://docs.djangoproject.com/en/1.9/howto/static-files/
171
172 STATIC_URL = '/static/'
173 if DEBUG:
174 STATICFILES_FINDERS = (
175 'django.contrib.staticfiles.finders.FileSystemFinder',
176 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
177 'django.contrib.staticfiles.finders.DefaultStorageFinder'
178 )
179 STATICFILES_DIRS = (
180 # Put strings here, like "/home/html/static" or "C:/www/django/static".
181 # Always use forward slashes, even on Windows.
182 # Don't forget to use absolute paths, not relative paths.
183 os.path.join(BASE_DIR, "static"),
184 )
185 else:
186 STATIC_ROOT = os.path.join(BASE_DIR, "static/")
187
188 LOCALE_PATHS = (
189 os.path.join(BASE_DIR, 'locale'),
190 )