| lombardofr | 3218b2b | 2018-10-29 13:41:08 +0100 | [diff] [blame] | 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 | # |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 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' |
| lombardofr | c89a4a0 | 2018-09-02 16:15:25 +0200 | [diff] [blame] | 28 | if os.getenv('DJANGO_ENV') == 'prod': |
| 29 | DEBUG = False |
| 30 | else: |
| 31 | DEBUG = True |
| lombardofr | 3fcf21a | 2019-03-11 10:26:08 +0100 | [diff] [blame^] | 32 | |
| lombardofr | c89a4a0 | 2018-09-02 16:15:25 +0200 | [diff] [blame] | 33 | ALLOWED_HOSTS = ['*'] |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 34 | |
| lombardofr | 099364f | 2018-06-12 11:21:02 +0200 | [diff] [blame] | 35 | AUTH_USER_MODEL = "authosm.OsmUser" |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 36 | |
| lombardof | 3384829 | 2018-05-08 10:12:14 +0200 | [diff] [blame] | 37 | SITE_NAME = "Open Source MANO" |
| 38 | SHORT_SITE_NAME = "OSM" |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 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', |
| lombardofr | 0793022 | 2018-06-19 16:59:45 +0200 | [diff] [blame] | 53 | 'django.contrib.sessions', |
| lombardofr | 099364f | 2018-06-12 11:21:02 +0200 | [diff] [blame] | 54 | 'authosm', |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 55 | 'projecthandler', |
| lombardofr | e1ed7b2 | 2018-12-19 17:27:24 +0100 | [diff] [blame] | 56 | 'packagehandler', |
| lombardofr | 3218b2b | 2018-10-29 13:41:08 +0100 | [diff] [blame] | 57 | 'descriptorhandler', |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 58 | 'vimhandler', |
| lombardofr | 3fcf21a | 2019-03-11 10:26:08 +0100 | [diff] [blame^] | 59 | 'wimhandler', |
| lombardof | a03da5e | 2018-06-02 18:36:44 +0200 | [diff] [blame] | 60 | 'instancehandler', |
| lombardofr | 099364f | 2018-06-12 11:21:02 +0200 | [diff] [blame] | 61 | 'sdnctrlhandler', |
| lombardofr | c3051ef | 2019-01-16 10:59:18 +0100 | [diff] [blame] | 62 | 'userhandler', |
| 63 | 'netslicehandler' |
| lombardofr | 099364f | 2018-06-12 11:21:02 +0200 | [diff] [blame] | 64 | |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 65 | ] |
| 66 | |
| 67 | MIDDLEWARE_CLASSES = [ |
| 68 | 'django.middleware.security.SecurityMiddleware', |
| 69 | 'django.contrib.sessions.middleware.SessionMiddleware', |
| lombardofr | 99f922f | 2018-07-17 17:27:36 +0200 | [diff] [blame] | 70 | 'projecthandler.middleware.OsmProjectMiddleware', |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 71 | 'django.middleware.common.CommonMiddleware', |
| 72 | 'django.middleware.csrf.CsrfViewMiddleware', |
| 73 | 'django.contrib.auth.middleware.AuthenticationMiddleware', |
| 74 | 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', |
| 75 | 'django.contrib.messages.middleware.MessageMiddleware', |
| 76 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
| 77 | |
| lombardofr | 99f922f | 2018-07-17 17:27:36 +0200 | [diff] [blame] | 78 | |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 79 | ] |
| 80 | |
| lombardofr | 0793022 | 2018-06-19 16:59:45 +0200 | [diff] [blame] | 81 | SESSION_ENGINE ='django.contrib.sessions.backends.db' |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 82 | SESSION_COOKIE_AGE = 3500 #25 min |
| 83 | SESSION_EXPIRE_AT_BROWSER_CLOSE = True |
| 84 | SESSION_SAVE_EVERY_REQUEST = True |
| 85 | |
| 86 | ROOT_URLCONF = 'sf_t3d.urls' |
| 87 | |
| 88 | TEMPLATES = [ |
| 89 | { |
| 90 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
| 91 | 'DIRS': [ |
| 92 | os.path.join(BASE_DIR, 'template'), |
| 93 | os.path.join(BASE_DIR, 'projecthandler', 'template'), |
| 94 | os.path.join(BASE_DIR, 'projecthandler', 'template', 'download'), |
| 95 | os.path.join(BASE_DIR, 'projecthandler', 'template', 'project'), |
| lombardofr | e1ed7b2 | 2018-12-19 17:27:24 +0100 | [diff] [blame] | 96 | os.path.join(BASE_DIR, 'packagehandler', 'template'), |
| lombardofr | 3218b2b | 2018-10-29 13:41:08 +0100 | [diff] [blame] | 97 | os.path.join(BASE_DIR, 'descriptorhandler', 'template'), |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 98 | os.path.join(BASE_DIR, 'vimhandler', 'template'), |
| lombardofr | 3fcf21a | 2019-03-11 10:26:08 +0100 | [diff] [blame^] | 99 | os.path.join(BASE_DIR, 'wimhandler', 'template'), |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 100 | os.path.join(BASE_DIR, 'instancehandler', 'template'), |
| lombardof | a03da5e | 2018-06-02 18:36:44 +0200 | [diff] [blame] | 101 | os.path.join(BASE_DIR, 'sdnctrlhandler', 'template'), |
| lombardofr | 10b52d1 | 2018-07-17 23:42:28 +0200 | [diff] [blame] | 102 | os.path.join(BASE_DIR, 'userhandler', 'templates'), |
| lombardofr | c3051ef | 2019-01-16 10:59:18 +0100 | [diff] [blame] | 103 | os.path.join(BASE_DIR, 'netslicehandler', 'template'), |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 104 | ], |
| 105 | 'APP_DIRS': True, |
| 106 | 'OPTIONS': { |
| 107 | 'context_processors': [ |
| 108 | 'django.template.context_processors.debug', |
| 109 | 'django.template.context_processors.request', |
| 110 | 'django.contrib.auth.context_processors.auth', |
| 111 | 'django.contrib.messages.context_processors.messages', |
| 112 | 'sf_t3d.context_processor.conf_constants', |
| 113 | ], |
| 114 | 'libraries':{ |
| 115 | 'get': 'sf_t3d.templatetags.get', |
| lombardof | 74ed51a | 2018-05-11 01:07:01 +0200 | [diff] [blame] | 116 | 'date_tag': 'sf_t3d.templatetags.datetag', |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 117 | } |
| 118 | }, |
| 119 | }, |
| 120 | ] |
| 121 | |
| 122 | WSGI_APPLICATION = 'sf_t3d.wsgi.application' |
| 123 | |
| 124 | |
| 125 | # Database |
| 126 | # https://docs.djangoproject.com/en/1.9/ref/settings/#databases |
| 127 | |
| 128 | DATABASES = { |
| 129 | 'default': { |
| 130 | 'ENGINE': 'django.db.backends.sqlite3', |
| 131 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), |
| 132 | } |
| 133 | } |
| 134 | |
| lombardofr | 099364f | 2018-06-12 11:21:02 +0200 | [diff] [blame] | 135 | AUTHENTICATION_BACKENDS = ['authosm.backend.OsmBackend'] |
| 136 | |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 137 | |
| 138 | # Password validation |
| 139 | # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators |
| 140 | |
| 141 | AUTH_PASSWORD_VALIDATORS = [ |
| 142 | { |
| 143 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', |
| 144 | }, |
| 145 | { |
| 146 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', |
| 147 | }, |
| 148 | { |
| 149 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', |
| 150 | }, |
| 151 | { |
| 152 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', |
| 153 | }, |
| 154 | ] |
| 155 | |
| 156 | |
| 157 | # Internationalization |
| 158 | # https://docs.djangoproject.com/en/1.9/topics/i18n/ |
| 159 | |
| 160 | LANGUAGE_CODE = 'en-us' |
| 161 | |
| 162 | TIME_ZONE = 'UTC' |
| 163 | |
| 164 | USE_I18N = True |
| 165 | |
| 166 | USE_L10N = True |
| 167 | |
| 168 | USE_TZ = True |
| 169 | |
| 170 | |
| 171 | # Static files (CSS, JavaScript, Images) |
| 172 | # https://docs.djangoproject.com/en/1.9/howto/static-files/ |
| 173 | |
| 174 | STATIC_URL = '/static/' |
| lombardofr | c89a4a0 | 2018-09-02 16:15:25 +0200 | [diff] [blame] | 175 | if DEBUG: |
| 176 | STATICFILES_FINDERS = ( |
| 177 | 'django.contrib.staticfiles.finders.FileSystemFinder', |
| 178 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', |
| 179 | 'django.contrib.staticfiles.finders.DefaultStorageFinder' |
| 180 | ) |
| 181 | STATICFILES_DIRS = ( |
| 182 | # Put strings here, like "/home/html/static" or "C:/www/django/static". |
| 183 | # Always use forward slashes, even on Windows. |
| 184 | # Don't forget to use absolute paths, not relative paths. |
| 185 | os.path.join(BASE_DIR, "static"), |
| 186 | ) |
| 187 | else: |
| 188 | STATIC_ROOT = os.path.join(BASE_DIR, "static/") |
| lombardof | fb37bca | 2018-05-03 16:20:04 +0200 | [diff] [blame] | 189 | |
| 190 | LOCALE_PATHS = ( |
| 191 | os.path.join(BASE_DIR, 'locale'), |
| lombardofr | c89a4a0 | 2018-09-02 16:15:25 +0200 | [diff] [blame] | 192 | ) |