diff --git a/Dockerfile b/Dockerfile index ce5e820..8cf1af4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.6.9 +FROM python:3.8 RUN apt-get update && apt-get install -y \ default-mysql-client \ @@ -9,7 +9,6 @@ RUN apt-get update && apt-get install -y \ # Get IRAP self signed certificate 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 -RUN pip install --upgrade pip # adding new user (pyros_user) and creating his home folder RUN useradd --create-home --shell /bin/bash pyros_user @@ -21,6 +20,9 @@ WORKDIR /home/pyros_user/app # switch from root to pyros_user USER pyros_user +RUN pip install --user --upgrade pip +RUN pip install --user wheel +RUN pip install --user numpy # copy local host machine files to image COPY --chown=pyros_user:pyros_user . . diff --git a/install/requirements.txt b/install/requirements.txt index ad7fbca..b68ea20 100644 --- a/install/requirements.txt +++ b/install/requirements.txt @@ -1,35 +1,35 @@ -anyjson==0.3.3 +anyjson click -DateTime==4.2 -Django==2.0.5 -django-admin-tools==0.8.1 -django-bootstrap3==10.0.1 -django-extensions==2.0.7 +DateTime +Django==3.2 +django-admin-tools +django-bootstrap3 +django-extensions # for Choices django-model-utils -django-suit==0.2.26 -django-test-without-migrations==0.6 +django-suit +django-test-without-migrations #gunicorn==19.8.1 -iso8601==0.1.12 -jdcal==1.4 +iso8601 +jdcal #lxml==4.3.0 -lxml==4.5.1 -mysqlclient==1.3.12 +lxml +mysqlclient #pluggy>=0.7 -pluggy==0.8.1 -py==1.5.3 -pytz==2018.4 -requests==2.18.4 -six==1.11.0 -sqlparse==0.2.4 -Twisted==18.4.0 -voevent-parse==1.0.3 -zope.interface==5.2.0 +pluggy +py +pytz +requests +six +sqlparse +Twisted +voevent-parse +zope.interface # For DEV -django-debug-toolbar==1.9.1 +django-debug-toolbar # Modifications 2021 : # 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 # For working with date python-dateutil -# Celme / guitastro packages +# Celme / guitastro packages +# pypylon not available for 3.10 at 2021/11/10 (cf https://github.com/basler/pypylon#binary-installation) pypylon sep astroquery astroalign +# ccdproc requires astroscrappy which doesn't work on Python versions > 3.8 (cf https://github.com/astropy/astroscrappy/issues/55) +# There is also an issue with astroscrappy with numpy (module not found despite installing numpy in advance) ccdproc \ No newline at end of file diff --git a/pyros.py b/pyros.py index 75f55ca..e9e5c88 100755 --- a/pyros.py +++ b/pyros.py @@ -660,7 +660,7 @@ def start(agent:str, configfile:str,observatory:str,unit:str): if unit: os.environ["unit_name"] = unit else: - os.environ["unit_name"] = None + os.environ["unit_name"] = "" # add path to pyros_django folder as the config class is supposed to work within this folder #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'))}')\"" cmd_test_obs_config = f"-c \"from src.core.pyros_django.obsconfig.configpyros import ConfigPyros\nConfigPyros('{obs_config_file_path}')\"" diff --git a/src/core/pyros_django/dashboard/views.py b/src/core/pyros_django/dashboard/views.py index e2c39f7..ff7b995 100644 --- a/src/core/pyros_django/dashboard/views.py +++ b/src/core/pyros_django/dashboard/views.py @@ -43,7 +43,7 @@ log = l.setupLogger("dashboard", "dashboard") def index(request): config = ConfigPyros(os.environ["PATH_TO_OBSCONF_FILE"],os.environ["unit_name"]) observatory_name = config.get_obs_name() - unit_name = os.environ["unit_name"] + unit_name = config.unit_name request.session["obsname"] = observatory_name+" "+unit_name message = "" diff --git a/src/core/pyros_django/misc/templates/base.html b/src/core/pyros_django/misc/templates/base.html index 0e1a541..402e5f1 100644 --- a/src/core/pyros_django/misc/templates/base.html +++ b/src/core/pyros_django/misc/templates/base.html @@ -2,7 +2,7 @@
- {% load staticfiles %} + {% load static %} diff --git a/src/core/pyros_django/pyros/settings.py b/src/core/pyros_django/pyros/settings.py index 5feb8cb..958127d 100644 --- a/src/core/pyros_django/pyros/settings.py +++ b/src/core/pyros_django/pyros/settings.py @@ -286,6 +286,8 @@ else: } } CONN_MAX_AGE = 0 +# New in Django 3.2 : we have to tell that we want auto field for id +DEFAULT_AUTO_FIELD='django.db.models.AutoField' # SIMULATOR==True ==> 'TEST (simu)' RUN MODE, use pyros_test database if SIMULATOR: DATABASES = { @@ -352,7 +354,8 @@ USE_L10N = True USE_TZ = True # To find the media files {{ MEDIA_URL }} -MEDIA_URL = '/public/static/media/' +# change with Django 3.2 : media url can't be within static folder +MEDIA_URL = '/public/media/' # To find the static files in the app/static/app/... folders diff --git a/src/core/pyros_django/scientific_program/tests.py b/src/core/pyros_django/scientific_program/tests.py index 3bab2c6..ee450e8 100644 --- a/src/core/pyros_django/scientific_program/tests.py +++ b/src/core/pyros_django/scientific_program/tests.py @@ -209,16 +209,16 @@ class ScientificProgramTests(TestCase): "public_visibility":SP_Period.VISIBILITY_YES, "quota_minimal":2, "quota_nominal":5, - "quota_allocated":None, + "quota_allocated":"", "over_quota_duration":2, - "over_quota_duration_allocated":None, + "over_quota_duration_allocated":"", "token":2, - "token_allocated":None, - "vote_referee1":None, - "reason_referee1":None, - "vote_referee2":None, - "reason_referee2":None, - "priority":None, + "token_allocated":"", + "vote_referee1":"", + "reason_referee1":"", + "vote_referee2":"", + "reason_referee2":"", + "priority":"", "is_valid":False } response = self.client.post(path,post_data) diff --git a/src/core/pyros_django/user_manager/forms.py b/src/core/pyros_django/user_manager/forms.py index dd519ec..bd7ba97 100644 --- a/src/core/pyros_django/user_manager/forms.py +++ b/src/core/pyros_django/user_manager/forms.py @@ -27,9 +27,10 @@ class PyrosUserCreationForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(PyrosUserCreationForm, self).__init__(*args, **kwargs) - self.fields.move_to_end('tel', True) - self.fields.move_to_end('laboratory', True) - self.fields.move_to_end('address', True) + # Python > 3.7 : move_to_end isn't a function of Dict anymore (but works on OrderedDict) + # self.fields.move_to_end('tel', True) + # self.fields.move_to_end('laboratory', True) + # self.fields.move_to_end('address', True) for field in self.fields.values(): field.required = True field.widget.attrs['class'] = "form-control" diff --git a/src/core/pyros_django/user_manager/templates/user_manager/base_home.html b/src/core/pyros_django/user_manager/templates/user_manager/base_home.html index 5a363ab..da026f6 100644 --- a/src/core/pyros_django/user_manager/templates/user_manager/base_home.html +++ b/src/core/pyros_django/user_manager/templates/user_manager/base_home.html @@ -5,7 +5,7 @@ - {% load staticfiles %} + {% load static %} -- libgit2 0.21.2