Skip to content

Commit

Permalink
Fixed the creation the path to the product
Browse files Browse the repository at this point in the history
  • Loading branch information
crisingulani committed Sep 13, 2024
1 parent 4c85c31 commit f0a2fad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 4 additions & 1 deletion backend/core/views/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 4 additions & 4 deletions backend/pzserver/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)))
Expand Down Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions env_template
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down

0 comments on commit f0a2fad

Please sign in to comment.