Skip to content

Commit

Permalink
[FIX] add static urls even if not in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dameyerdave committed Dec 15, 2023
1 parent 5587ab3 commit c8643a3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports.ruff": true
// "source.organizeImports": "explicit"
"source.organizeImports.ruff": "explicit"
}
},
"python.testing.pytestArgs": ["api/app"],
Expand Down
18 changes: 10 additions & 8 deletions api/app/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,16 @@ class AnalysisJob(models.Model):

@property
def manifest(self):
manifest_text = f"""STUDY {self.job.result['experiment']['study_alias']}
SAMPLE {self.job.result['experiment']['sample_alias']}
RUN_REF {self.job.result['run']['accession']}
"""
for key, value in self.data.items():
manifest_text += f"{key.upper()} {value}\n"
for file in self.analysisjob_files.all():
manifest_text += f"{file.file_type} {file.file_name}\n"
manifest_text = ""
if self.job.result:
manifest_text = f"""STUDY {self.job.result['experiment']['study_alias']}
SAMPLE {self.job.result['experiment']['sample_alias']}
RUN_REF {self.job.result['run']['accession']}
"""
for key, value in self.data.items():
manifest_text += f"{key.upper()} {value}\n"
for file in self.analysisjob_files.all():
manifest_text += f"{file.file_type} {file.file_name}\n"
return manifest_text

class Meta:
Expand Down
5 changes: 5 additions & 0 deletions api/app/ena_upload_ms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"""
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from drf_auto_endpoint.router import router
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from rest_framework.authtoken import views as authtoken_views
from drf_spectacular.views import (
SpectacularAPIView,
Expand All @@ -43,3 +45,6 @@
name="redoc",
),
]

if not settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()

0 comments on commit c8643a3

Please sign in to comment.