Commit a6603b26cb78a806a9c3d93d15d71a4b4ce638d0
1 parent
d10072bb
Exists in
dev
Django and Python versions migration to Django 3 and Python 3.8
Showing
9 changed files
with
50 additions
and
41 deletions
Show diff stats
Dockerfile
1 | -FROM python:3.6.9 | |
1 | +FROM python:3.8 | |
2 | 2 | |
3 | 3 | RUN apt-get update && apt-get install -y \ |
4 | 4 | default-mysql-client \ |
... | ... | @@ -9,7 +9,6 @@ RUN apt-get update && apt-get install -y \ |
9 | 9 | # Get IRAP self signed certificate |
10 | 10 | RUN echo | openssl s_client -connect gitlab.irap.omp.eu:443 -servername gitlab.irap.omp.eu 2>/dev/null | openssl x509 > /etc/ssl/certs/gitlab.irap.omp.eu.crt |
11 | 11 | |
12 | -RUN pip install --upgrade pip | |
13 | 12 | |
14 | 13 | # adding new user (pyros_user) and creating his home folder |
15 | 14 | RUN useradd --create-home --shell /bin/bash pyros_user |
... | ... | @@ -21,6 +20,9 @@ WORKDIR /home/pyros_user/app |
21 | 20 | # switch from root to pyros_user |
22 | 21 | USER pyros_user |
23 | 22 | |
23 | +RUN pip install --user --upgrade pip | |
24 | +RUN pip install --user wheel | |
25 | +RUN pip install --user numpy | |
24 | 26 | # copy local host machine files to image |
25 | 27 | COPY --chown=pyros_user:pyros_user . . |
26 | 28 | ... | ... |
install/requirements.txt
1 | -anyjson==0.3.3 | |
1 | +anyjson | |
2 | 2 | click |
3 | -DateTime==4.2 | |
4 | -Django==2.0.5 | |
5 | -django-admin-tools==0.8.1 | |
6 | -django-bootstrap3==10.0.1 | |
7 | -django-extensions==2.0.7 | |
3 | +DateTime | |
4 | +Django==3.2 | |
5 | +django-admin-tools | |
6 | +django-bootstrap3 | |
7 | +django-extensions | |
8 | 8 | |
9 | 9 | # for Choices |
10 | 10 | django-model-utils |
11 | 11 | |
12 | -django-suit==0.2.26 | |
13 | -django-test-without-migrations==0.6 | |
12 | +django-suit | |
13 | +django-test-without-migrations | |
14 | 14 | #gunicorn==19.8.1 |
15 | -iso8601==0.1.12 | |
16 | -jdcal==1.4 | |
15 | +iso8601 | |
16 | +jdcal | |
17 | 17 | #lxml==4.3.0 |
18 | -lxml==4.5.1 | |
19 | -mysqlclient==1.3.12 | |
18 | +lxml | |
19 | +mysqlclient | |
20 | 20 | #pluggy>=0.7 |
21 | -pluggy==0.8.1 | |
22 | -py==1.5.3 | |
23 | -pytz==2018.4 | |
24 | -requests==2.18.4 | |
25 | -six==1.11.0 | |
26 | -sqlparse==0.2.4 | |
27 | -Twisted==18.4.0 | |
28 | -voevent-parse==1.0.3 | |
29 | -zope.interface==5.2.0 | |
21 | +pluggy | |
22 | +py | |
23 | +pytz | |
24 | +requests | |
25 | +six | |
26 | +sqlparse | |
27 | +Twisted | |
28 | +voevent-parse | |
29 | +zope.interface | |
30 | 30 | |
31 | 31 | # For DEV |
32 | -django-debug-toolbar==1.9.1 | |
32 | +django-debug-toolbar | |
33 | 33 | |
34 | 34 | # Modifications 2021 : |
35 | 35 | # removing plantuml because we need a unofficial version (maybe we could force to go back on an old version where the bug wasn't happening |
... | ... | @@ -59,9 +59,12 @@ GitPython |
59 | 59 | # For working with date |
60 | 60 | python-dateutil |
61 | 61 | |
62 | -# Celme / guitastro packages | |
62 | +# Celme / guitastro packages | |
63 | +# pypylon not available for 3.10 at 2021/11/10 (cf https://github.com/basler/pypylon#binary-installation) | |
63 | 64 | pypylon |
64 | 65 | sep |
65 | 66 | astroquery |
66 | 67 | astroalign |
68 | +# ccdproc requires astroscrappy which doesn't work on Python versions > 3.8 (cf https://github.com/astropy/astroscrappy/issues/55) | |
69 | +# There is also an issue with astroscrappy with numpy (module not found despite installing numpy in advance) | |
67 | 70 | ccdproc |
68 | 71 | \ No newline at end of file | ... | ... |
pyros.py
... | ... | @@ -660,7 +660,7 @@ def start(agent:str, configfile:str,observatory:str,unit:str): |
660 | 660 | if unit: |
661 | 661 | os.environ["unit_name"] = unit |
662 | 662 | else: |
663 | - os.environ["unit_name"] = None | |
663 | + os.environ["unit_name"] = "" | |
664 | 664 | # add path to pyros_django folder as the config class is supposed to work within this folder |
665 | 665 | #cmd_test_obs_config = f"-c \"from src.core.pyros_django.obsconfig.configpyros import ConfigPyros\nConfigPyros('{os.path.join(PYROS_DJANGO_BASE_DIR,os.environ.get('PATH_TO_OBSCONF_FILE'))}')\"" |
666 | 666 | cmd_test_obs_config = f"-c \"from src.core.pyros_django.obsconfig.configpyros import ConfigPyros\nConfigPyros('{obs_config_file_path}')\"" | ... | ... |
src/core/pyros_django/dashboard/views.py
... | ... | @@ -43,7 +43,7 @@ log = l.setupLogger("dashboard", "dashboard") |
43 | 43 | def index(request): |
44 | 44 | config = ConfigPyros(os.environ["PATH_TO_OBSCONF_FILE"],os.environ["unit_name"]) |
45 | 45 | observatory_name = config.get_obs_name() |
46 | - unit_name = os.environ["unit_name"] | |
46 | + unit_name = config.unit_name | |
47 | 47 | request.session["obsname"] = observatory_name+" "+unit_name |
48 | 48 | |
49 | 49 | message = "" | ... | ... |
src/core/pyros_django/misc/templates/base.html
src/core/pyros_django/pyros/settings.py
... | ... | @@ -286,6 +286,8 @@ else: |
286 | 286 | } |
287 | 287 | } |
288 | 288 | CONN_MAX_AGE = 0 |
289 | +# New in Django 3.2 : we have to tell that we want auto field for id | |
290 | +DEFAULT_AUTO_FIELD='django.db.models.AutoField' | |
289 | 291 | # SIMULATOR==True ==> 'TEST (simu)' RUN MODE, use pyros_test database |
290 | 292 | if SIMULATOR: |
291 | 293 | DATABASES = { |
... | ... | @@ -352,7 +354,8 @@ USE_L10N = True |
352 | 354 | USE_TZ = True |
353 | 355 | |
354 | 356 | # To find the media files {{ MEDIA_URL }} |
355 | -MEDIA_URL = '/public/static/media/' | |
357 | +# change with Django 3.2 : media url can't be within static folder | |
358 | +MEDIA_URL = '/public/media/' | |
356 | 359 | |
357 | 360 | |
358 | 361 | # To find the static files in the app/static/app/... folders | ... | ... |
src/core/pyros_django/scientific_program/tests.py
... | ... | @@ -209,16 +209,16 @@ class ScientificProgramTests(TestCase): |
209 | 209 | "public_visibility":SP_Period.VISIBILITY_YES, |
210 | 210 | "quota_minimal":2, |
211 | 211 | "quota_nominal":5, |
212 | - "quota_allocated":None, | |
212 | + "quota_allocated":"", | |
213 | 213 | "over_quota_duration":2, |
214 | - "over_quota_duration_allocated":None, | |
214 | + "over_quota_duration_allocated":"", | |
215 | 215 | "token":2, |
216 | - "token_allocated":None, | |
217 | - "vote_referee1":None, | |
218 | - "reason_referee1":None, | |
219 | - "vote_referee2":None, | |
220 | - "reason_referee2":None, | |
221 | - "priority":None, | |
216 | + "token_allocated":"", | |
217 | + "vote_referee1":"", | |
218 | + "reason_referee1":"", | |
219 | + "vote_referee2":"", | |
220 | + "reason_referee2":"", | |
221 | + "priority":"", | |
222 | 222 | "is_valid":False |
223 | 223 | } |
224 | 224 | response = self.client.post(path,post_data) | ... | ... |
src/core/pyros_django/user_manager/forms.py
... | ... | @@ -27,9 +27,10 @@ class PyrosUserCreationForm(forms.ModelForm): |
27 | 27 | |
28 | 28 | def __init__(self, *args, **kwargs): |
29 | 29 | super(PyrosUserCreationForm, self).__init__(*args, **kwargs) |
30 | - self.fields.move_to_end('tel', True) | |
31 | - self.fields.move_to_end('laboratory', True) | |
32 | - self.fields.move_to_end('address', True) | |
30 | + # Python > 3.7 : move_to_end isn't a function of Dict anymore (but works on OrderedDict) | |
31 | + # self.fields.move_to_end('tel', True) | |
32 | + # self.fields.move_to_end('laboratory', True) | |
33 | + # self.fields.move_to_end('address', True) | |
33 | 34 | for field in self.fields.values(): |
34 | 35 | field.required = True |
35 | 36 | field.widget.attrs['class'] = "form-control" | ... | ... |
src/core/pyros_django/user_manager/templates/user_manager/base_home.html