diff --git a/backend/core/views/process.py b/backend/core/views/process.py index 5dc049d..0b973a2 100644 --- a/backend/core/views/process.py +++ b/backend/core/views/process.py @@ -111,9 +111,12 @@ def create(self, request): for _input in _inputs: main_file = _input.files.get(role=0) filepath = pathlib.Path( - settings.MEDIA_ROOT, _input.path, main_file.name + settings.UPLOAD_DIR, _input.path, main_file.name ) + if not filepath.is_file(): + raise FileNotFoundError(f"File not found: {str(filepath)}") + ra = self.__get_mapped_column(_input, "RA") dec = self.__get_mapped_column(_input, "Dec") z = self.__get_mapped_column(_input, "z") diff --git a/backend/pzserver/settings.py b/backend/pzserver/settings.py index e03e99c..cdd7909 100644 --- a/backend/pzserver/settings.py +++ b/backend/pzserver/settings.py @@ -14,8 +14,6 @@ import saml2 -# import saml2.saml - # Build paths inside the project like this: BASE_DIR / 'subdir'. # BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -156,8 +154,10 @@ STATIC_URL = "/django_static/" STATIC_ROOT = os.path.join(BASE_DIR, "django_static") -MEDIA_URL = os.getenv("MEDIA_URL", "/archive/data/") -MEDIA_ROOT = os.getenv("MEDIA_ROOT", "/archive/data/") +MEDIA_URL = "/archive/data/" +MEDIA_ROOT = MEDIA_URL + +UPLOAD_DIR = os.getenv("UPLOAD_DIR", MEDIA_URL) # Default primary key field type # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field diff --git a/env_template b/env_template index 056adf0..c8931fd 100644 --- a/env_template +++ b/env_template @@ -78,10 +78,6 @@ PIPELINES_DIR=/pipelines # directory where it will contain the datasets. DATASETS_DIR=/datasets -# Upload dir -MEDIA_URL=/archive/data -MEDIA_ROOT=/archive/data - # Saml2 / Satosa Auth # URL to login using satosa # AUTH_SHIB_URL=${URI}/saml2/login/