test_settings_NOTUSED.py
8.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
""" OBSOLETE FILE """
"""
Django settings for pyros project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
# Dictionary containing all the versions for the different modules
# IMPORTANT : I must be updated at every commit !
MODULES_VERSIONS = {
"Alert Manager" : "0.2.4",
"Analyzer" : "0.1.2",
"Dashboard" : "0.1.1",
"Majordome" : "0.1.4",
"Monitoring" : "0.1.3",
"Observation Manager" : "0.1.3",
"Routine Manager" : "0.1.2",
"Scheduler" : "0.1.2",
"User Manager" : "0.1.1",
"Device" : "0.1.1"
}
# Set MYSQL to False if you want to use SQLITE
# This line MUST NOT be changed at all except from changing True/False
# (or install_requirements script will become invalid)
MYSQL = True
# YOU MUST CHANGE THIS VALUE IN PYROSRUN.SH TOO
TEST_PORT = 8001
# YOU MUST CHANGE THIS VALUE IN PYROSRUN.SH TOO
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '0*@w)$rq4x1c2w!c#gn58*$*u$w=s8uw2zpr_c3nj*u%qlxc23'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['localhost']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# for using "./manage.py graph_models" with graphviz:
# (https://projects.irap.omp.eu/projects/pyros/wiki/Project_Development#django-extensions-and-graphviz-useful-for-generating-an-image-of-all-the-models-and-their-relationships)
'django_extensions',
'test_without_migrations',
'bootstrap3',
'dashboard',
'scheduler',
'common',
'alert_manager',
'analyzer',
'majordome',
'monitoring',
'observation_manager',
'routine_manager',
'user_manager',
'devices'
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'pyros.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['misc/templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'pyros.wsgi.application'
FIXTURE_DIRS = (
'misc/fixtures/',
)
LOGIN_URL = "/"
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
# EP modif
CELERY_TEST = False
if not CELERY_TEST:
if not MYSQL:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'test_pyros',
'USER': 'pyros',
'PASSWORD': 'DjangoPyros',
}
}
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'testdb.sqlite3'),
'TEST': {
'NAME': os.path.join(BASE_DIR, 'testdb.sqlite3'),
},
}
}
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
#LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'fr-FR'
#TIME_ZONE = 'UTC'
TIME_ZONE = 'Europe/Paris'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# To find the media files {{ MEDIA_URL }}
MEDIA_URL = '/public/static/media/'
# To find the static files in the app/static/ap/... folders
STATIC_URL = '/public/static/'
# To find the static files in src/static/. Any local directory can be added to this list.
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "misc", "static"),
)
# Used for deployment (DEBUG = False). Need to run "python manage.py collectstatic" to fill it.
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'public', 'static')
# EP added
if not DEBUG:
'''
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
'''
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
'LOCATION': '/var/tmp/django_cache',
}
}
else:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
# from django.core.cache import cache
# cache.clear()
# CELERY CONFIG
# CELERY_RESULT_BACKEND = 'rpc://'
CELERY_RESULT_BACKEND = 'amqp'
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_IMPORTS = (
"alert_manager.tasks",
"analyzer.tasks",
"majordome.tasks",
"monitoring.tasks",
"observation_manager.tasks",
"scheduler.tasks",
)
# This config allows only 1 process / queue. We replace it by the -c option at celery workers creation.
# CELERYD_CONCURRENCY = 1
''' Following config is needed for manual purge '''
CELERY_ACKS_LATE = False
CELERYD_PREFETCH_MULTIPLIER = 1
CELERY_QUEUES = {
"alert_listener_q": {"exchange": "alert_listener_q", "routing_key": "alert_listener_q"},
"analysis_q": {"exchange": "analysis_q", "routing_key": "analysis_q"},
"system_status_q": {"exchange": "system_status_q", "routing_key": "system_status_q"},
"change_obs_conditions_q": {"exchange": "change_obs_conditions_q", "routing_key": "change_obs_conditions_q"},
"monitoring_q": {"exchange": "monitoring_q", "routing_key": "monitoring_q"},
"scheduling_q": {"exchange": "scheduling_q", "routing_key": "scheduling_q"},
"execute_sequence_q": {"exchange": "execute_sequence_q", "routing_key": "execute_sequence_q"},
"execute_plan_vis_q": {"exchange": "execute_plan_vis_q", "routing_key": "execute_plan_vis_q"},
"execute_plan_nir_q": {"exchange": "execute_plan_nir_q", "routing_key": "execute_plan_nir_q"},
"create_calibrations_q": {"exchange": "create_calibrations_q", "routing_key": "create_calibrations_q"},
}
CELERY_ROUTES = {
"alert_manager.tasks.alert_listener": {"queue": "alert_listener_q"},
"analyzer.tasks.analysis": {"queue": "analysis_q"},
"majordome.tasks.execute_sequence": {"queue": "execute_sequence_q"},
"majordome.tasks.system_pause": {"queue": "system_status_q"},
"majordome.tasks.system_restart": {"queue": "system_status_q"},
"majordome.tasks.change_obs_conditions": {"queue": "change_obs_conditions_q"},
"monitoring.tasks.monitoring": {"queue": "monitoring_q"},
"observation_manager.tasks.execute_plan_vis": {"queue": "execute_plan_vis_q"},
"observation_manager.tasks.execute_plan_nir": {"queue": "execute_plan_nir_q"},
"observation_manager.tasks.create_calibrations": {"queue": "create_calibrations_q"},
"scheduler.tasks.scheduling": {"queue": "scheduling_q"},
}
''' Removes pickle warning '''
CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']