Commit 2cf9e14fda037df2c9354f1757c60c9e8befb7e5
1 parent
28e8d4bb
Exists in
master
and in
1 other branch
fix install script
Showing
4 changed files
with
297 additions
and
23 deletions
Show diff stats
install/install_requirements.sh
... | ... | @@ -42,7 +42,7 @@ INSTALLATION_FINISHED="-Installation finished" |
42 | 42 | BAD_SQL_CONFIGURATION="-Migration cannot be applied to the database : check your database configuration, or use sqlite instead" |
43 | 43 | TELL_SUPERUSER_CREATION="-Superuser created for django admin interface. Login: $DB_USER , password: $DB_PASSWORD" |
44 | 44 | MAKE_MIGRATIONS="-Make migrations for DB models" |
45 | -LOAD_FIXTURES="-Loading textures ..." | |
45 | +LOAD_FIXTURES="-Loading fixtures ..." | |
46 | 46 | FINAL_MESSAGE="-Please run './pyrosrun server' then go to localhost:$PORT/admin and log in with these id" |
47 | 47 | |
48 | 48 | # Getting python location |
... | ... | @@ -143,12 +143,12 @@ if [ $? -ne 0 ]; then |
143 | 143 | exit |
144 | 144 | fi |
145 | 145 | |
146 | -echo $CREATE_SUPERUSER | |
147 | -echo $CREATE_SUPERUSER_SCRIPT | python ../src/manage.py shell | |
148 | - | |
149 | 146 | echo $LOAD_FIXTURES |
150 | 147 | python manage.py loaddata fixtures/initial_fixture.json |
151 | 148 | |
149 | +echo $CREATE_SUPERUSER | |
150 | +echo $CREATE_SUPERUSER_SCRIPT | python ../src/manage.py shell | |
151 | + | |
152 | 152 | echo $TELL_SUPERUSER_CREATION |
153 | 153 | read -n1 -r -p "Press any key to continue..." key |
154 | 154 | echo $FINAL_MESSAGE | ... | ... |
src/fixtures/initial_fixture.json
... | ... | @@ -5820,24 +5820,6 @@ |
5820 | 5820 | }, |
5821 | 5821 | { |
5822 | 5822 | "model": "auth.user", |
5823 | - "pk": 3, | |
5824 | - "fields": { | |
5825 | - "password": "pbkdf2_sha256$24000$okuSDTx60Vgu$awy4V1udsOOFh4PhGvMWbZLbgcHdbMHEvGsmlx08n5w=", | |
5826 | - "last_login": "2016-04-04T10:05:28Z", | |
5827 | - "is_superuser": true, | |
5828 | - "username": "admin", | |
5829 | - "first_name": "", | |
5830 | - "last_name": "", | |
5831 | - "email": "admin@example.com", | |
5832 | - "is_staff": true, | |
5833 | - "is_active": true, | |
5834 | - "date_joined": "2016-04-04T10:04:19Z", | |
5835 | - "groups": [], | |
5836 | - "user_permissions": [] | |
5837 | - } | |
5838 | -}, | |
5839 | -{ | |
5840 | - "model": "auth.user", | |
5841 | 5823 | "pk": 6, |
5842 | 5824 | "fields": { |
5843 | 5825 | "password": "pbkdf2_sha256$24000$INnv1PBisCaS$2YY/3Nws6EqMJAnaozZQaryERI0W5dTiQRUs9S0RBoc=", | ... | ... |
src/pyros/settings.py
... | ... | @@ -29,7 +29,7 @@ MODULES_VERSIONS = { |
29 | 29 | # Set MYSQL to False if you want to use SQLITE |
30 | 30 | # This line MUST NOT be changed at all except from changing True/False |
31 | 31 | # (or install_requirements script will become invalid) |
32 | -MYSQL = True | |
32 | +MYSQL = False | |
33 | 33 | |
34 | 34 | import os |
35 | 35 | ... | ... |
... | ... | @@ -0,0 +1,292 @@ |
1 | +๏ปฟ""" | |
2 | +Django settings for pyros project. | |
3 | + | |
4 | +Generated by 'django-admin startproject' using Django 1.9.4. | |
5 | + | |
6 | +For more information on this file, see | |
7 | +https://docs.djangoproject.com/en/1.9/topics/settings/ | |
8 | + | |
9 | +For the full list of settings and their values, see | |
10 | +https://docs.djangoproject.com/en/1.9/ref/settings/ | |
11 | +""" | |
12 | + | |
13 | +# Dictionary containing all the versions for the different modules | |
14 | +# IMPORTANT : I must be updated at every commit ! | |
15 | + | |
16 | +MODULES_VERSIONS = { | |
17 | + "Alert Manager" : "0.2.4", | |
18 | + "Analyzer" : "0.1.2", | |
19 | + "Dashboard" : "0.1.1", | |
20 | + "Majordome" : "0.1.4", | |
21 | + "Monitoring" : "0.1.3", | |
22 | + "Observation Manager" : "0.1.3", | |
23 | + "Routine Manager" : "0.1.2", | |
24 | + "Scheduler" : "0.1.2", | |
25 | + "User Manager" : "0.1.1", | |
26 | + "Device" : "0.1.1" | |
27 | +} | |
28 | + | |
29 | +# Set MYSQL to False if you want to use SQLITE | |
30 | +# This line MUST NOT be changed at all except from changing True/False | |
31 | +# (or install_requirements script will become invalid) | |
32 | +MYSQL = False | |
33 | + | |
34 | +import os | |
35 | + | |
36 | +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | |
37 | +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
38 | + | |
39 | + | |
40 | +# Quick-start development settings - unsuitable for production | |
41 | +# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ | |
42 | + | |
43 | +# SECURITY WARNING: keep the secret key used in production secret! | |
44 | +SECRET_KEY = '0*@w)$rq4x1c2w!c#gn58*$*u$w=s8uw2zpr_c3nj*u%qlxc23' | |
45 | + | |
46 | +# SECURITY WARNING: don't run with debug turned on in production! | |
47 | +DEBUG = True | |
48 | +SIMULATION = False | |
49 | + | |
50 | +ALLOWED_HOSTS = ['localhost'] | |
51 | + | |
52 | + | |
53 | +# Application definition | |
54 | + | |
55 | +INSTALLED_APPS = [ | |
56 | + 'django.contrib.admin', | |
57 | + 'django.contrib.auth', | |
58 | + 'django.contrib.contenttypes', | |
59 | + 'django.contrib.sessions', | |
60 | + 'django.contrib.messages', | |
61 | + 'django.contrib.staticfiles', | |
62 | + | |
63 | + # for using "./manage.py graph_models" with graphviz: | |
64 | + # (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) | |
65 | + 'django_extensions', | |
66 | + 'test_without_migrations', | |
67 | + 'bootstrap3', | |
68 | + 'dashboard', | |
69 | + 'scheduler', | |
70 | + 'common', | |
71 | + 'alert_manager', | |
72 | + 'analyzer', | |
73 | + 'majordome', | |
74 | + 'monitoring', | |
75 | + 'observation_manager', | |
76 | + 'routine_manager', | |
77 | + 'user_manager', | |
78 | + 'devices' | |
79 | +] | |
80 | + | |
81 | +MIDDLEWARE_CLASSES = [ | |
82 | + 'django.middleware.security.SecurityMiddleware', | |
83 | + 'django.contrib.sessions.middleware.SessionMiddleware', | |
84 | + 'django.middleware.common.CommonMiddleware', | |
85 | + 'django.middleware.csrf.CsrfViewMiddleware', | |
86 | + 'django.contrib.auth.middleware.AuthenticationMiddleware', | |
87 | + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', | |
88 | + 'django.contrib.messages.middleware.MessageMiddleware', | |
89 | + 'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
90 | +] | |
91 | + | |
92 | +ROOT_URLCONF = 'pyros.urls' | |
93 | + | |
94 | +TEMPLATES = [ | |
95 | + { | |
96 | + 'BACKEND': 'django.template.backends.django.DjangoTemplates', | |
97 | + 'DIRS': ['templates'], | |
98 | + 'APP_DIRS': True, | |
99 | + 'OPTIONS': { | |
100 | + 'context_processors': [ | |
101 | + 'django.template.context_processors.debug', | |
102 | + 'django.template.context_processors.request', | |
103 | + 'django.contrib.auth.context_processors.auth', | |
104 | + 'django.contrib.messages.context_processors.messages', | |
105 | + ], | |
106 | + }, | |
107 | + }, | |
108 | +] | |
109 | + | |
110 | +WSGI_APPLICATION = 'pyros.wsgi.application' | |
111 | + | |
112 | +FIXTURE_DIRS = ( | |
113 | + 'fixtures/', | |
114 | +) | |
115 | + | |
116 | +LOGIN_URL = "/" | |
117 | + | |
118 | +# Database | |
119 | +# https://docs.djangoproject.com/en/1.9/ref/settings/#databases | |
120 | + | |
121 | +# EP modif | |
122 | + | |
123 | +CELERY_TEST = False | |
124 | + | |
125 | +if CELERY_TEST == False: | |
126 | + if MYSQL == False: | |
127 | + DATABASES = { | |
128 | + 'default': { | |
129 | + 'ENGINE': 'django.db.backends.sqlite3', | |
130 | + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | |
131 | + } | |
132 | + } | |
133 | + else: | |
134 | + DATABASES = { | |
135 | + 'default': { | |
136 | + 'ENGINE': 'django.db.backends.mysql', | |
137 | + 'NAME': 'pyros', | |
138 | + 'USER': 'pyros', | |
139 | + 'PASSWORD': 'DjangoPyros', | |
140 | + } | |
141 | + } | |
142 | +else: | |
143 | + if MYSQL == False: | |
144 | + DATABASES = { | |
145 | + 'default': { | |
146 | + 'ENGINE': 'django.db.backends.sqlite3', | |
147 | + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | |
148 | + 'TEST': { | |
149 | + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | |
150 | + }, | |
151 | + } | |
152 | + } | |
153 | + else: | |
154 | + DATABASES = { | |
155 | + 'default': { | |
156 | + 'ENGINE': 'django.db.backends.mysql', | |
157 | + 'NAME': 'pyros', | |
158 | + 'USER': 'pyros', | |
159 | + 'PASSWORD': 'DjangoPyros', | |
160 | + 'TEST': { | |
161 | + 'NAME': 'pyros', | |
162 | + }, | |
163 | + } | |
164 | + } | |
165 | + | |
166 | + | |
167 | +# Password validation | |
168 | +# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators | |
169 | + | |
170 | +AUTH_PASSWORD_VALIDATORS = [ | |
171 | + { | |
172 | + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | |
173 | + }, | |
174 | + { | |
175 | + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | |
176 | + }, | |
177 | + { | |
178 | + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | |
179 | + }, | |
180 | + { | |
181 | + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | |
182 | + }, | |
183 | +] | |
184 | + | |
185 | + | |
186 | +# Internationalization | |
187 | +# https://docs.djangoproject.com/en/1.9/topics/i18n/ | |
188 | + | |
189 | +LANGUAGE_CODE = 'en-us' | |
190 | + | |
191 | +TIME_ZONE = 'UTC' | |
192 | + | |
193 | +USE_I18N = True | |
194 | + | |
195 | +USE_L10N = True | |
196 | + | |
197 | +USE_TZ = True | |
198 | + | |
199 | + | |
200 | +# To find the static files in the app/static/ap/... folders | |
201 | +STATIC_URL = '/static/' | |
202 | + | |
203 | +# To find the static files in src/static/. Any local directory can be added to this list. | |
204 | +STATICFILES_DIRS = ( | |
205 | + os.path.join(BASE_DIR, "static"), | |
206 | + ) | |
207 | + | |
208 | +# Used for deployment (DEBUG = False). Need to run "python manage.py collectstatic" to fill it. | |
209 | +STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'public', 'static') | |
210 | + | |
211 | + | |
212 | +# EP added | |
213 | +if not DEBUG: | |
214 | + ''' | |
215 | + CACHES = { | |
216 | + 'default': { | |
217 | + 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', | |
218 | + 'LOCATION': '127.0.0.1:11211', | |
219 | + } | |
220 | + } | |
221 | + ''' | |
222 | + CACHES = { | |
223 | + 'default': { | |
224 | + 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', | |
225 | + 'LOCATION': '/var/tmp/django_cache', | |
226 | + } | |
227 | + } | |
228 | + | |
229 | +else: | |
230 | + CACHES = { | |
231 | + 'default': { | |
232 | + 'BACKEND': 'django.core.cache.backends.dummy.DummyCache', | |
233 | + } | |
234 | + } | |
235 | + | |
236 | +# from django.core.cache import cache | |
237 | +# cache.clear() | |
238 | + | |
239 | +# CELERY CONFIG | |
240 | + | |
241 | +# CELERY_RESULT_BACKEND = 'rpc://' | |
242 | +CELERY_RESULT_BACKEND = 'amqp' | |
243 | + | |
244 | +CELERY_ACCEPT_CONTENT = ['json'] | |
245 | +CELERY_TASK_SERIALIZER = 'json' | |
246 | +CELERY_RESULT_SERIALIZER = 'json' | |
247 | + | |
248 | +CELERY_IMPORTS = ( | |
249 | + "alert_manager.tasks", | |
250 | + "analyzer.tasks", | |
251 | + "majordome.tasks", | |
252 | + "monitoring.tasks", | |
253 | + "observation_manager.tasks", | |
254 | + "scheduler.tasks", | |
255 | +) | |
256 | + | |
257 | +# This config allows only 1 process / queue. We replace it by the -c option at celery workers creation. | |
258 | +# CELERYD_CONCURRENCY = 1 | |
259 | + | |
260 | +''' Following config is needed for manual purge ''' | |
261 | +CELERY_ACKS_LATE = False | |
262 | +CELERYD_PREFETCH_MULTIPLIER = 1 | |
263 | + | |
264 | +CELERY_QUEUES = { | |
265 | + "alert_listener_q": {"exchange": "alert_listener_q", "routing_key": "alert_listener_q"}, | |
266 | + "analysis_q": {"exchange": "analysis_q", "routing_key": "analysis_q"}, | |
267 | + "system_status_q": {"exchange": "system_status_q", "routing_key": "system_status_q"}, | |
268 | + "change_obs_conditions_q": {"exchange": "change_obs_conditions_q", "routing_key": "change_obs_conditions_q"}, | |
269 | + "monitoring_q": {"exchange": "monitoring_q", "routing_key": "monitoring_q"}, | |
270 | + "scheduling_q": {"exchange": "scheduling_q", "routing_key": "scheduling_q"}, | |
271 | + "execute_sequence_q": {"exchange": "execute_sequence_q", "routing_key": "execute_sequence_q"}, | |
272 | + "execute_plan_vis_q": {"exchange": "execute_plan_vis_q", "routing_key": "execute_plan_vis_q"}, | |
273 | + "execute_plan_nir_q": {"exchange": "execute_plan_nir_q", "routing_key": "execute_plan_nir_q"}, | |
274 | + "create_calibrations_q": {"exchange": "create_calibrations_q", "routing_key": "create_calibrations_q"}, | |
275 | +} | |
276 | + | |
277 | +CELERY_ROUTES = { | |
278 | + "alert_manager.tasks.alert_listener": {"queue": "alert_listener_q"}, | |
279 | + "analyzer.tasks.analysis": {"queue": "analysis_q"}, | |
280 | + "majordome.tasks.execute_sequence": {"queue": "execute_sequence_q"}, | |
281 | + "majordome.tasks.system_pause": {"queue": "system_status_q"}, | |
282 | + "majordome.tasks.system_restart": {"queue": "system_status_q"}, | |
283 | + "majordome.tasks.change_obs_conditions": {"queue": "change_obs_conditions_q"}, | |
284 | + "monitoring.tasks.monitoring": {"queue": "monitoring_q"}, | |
285 | + "observation_manager.tasks.execute_plan_vis": {"queue": "execute_plan_vis_q"}, | |
286 | + "observation_manager.tasks.execute_plan_nir": {"queue": "execute_plan_nir_q"}, | |
287 | + "observation_manager.tasks.create_calibrations": {"queue": "create_calibrations_q"}, | |
288 | + "scheduler.tasks.scheduling": {"queue": "scheduling_q"}, | |
289 | +} | |
290 | + | |
291 | +''' Removes pickle warning ''' | |
292 | +CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml'] | ... | ... |