Skip to content

Commit 95b6fff

Browse files
viseshrpCopilot
andauthored
serverless: Replace STATICFILES_DIRS to point only to django/static (#382)
Co-authored-by: viseshrp <11642379+viseshrp@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d90e526 commit 95b6fff

File tree

2 files changed

+420
-256
lines changed

2 files changed

+420
-256
lines changed

src/ansys/dynamicreporting/core/serverless/adr.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,21 @@ def setup(self, collect_static: bool = False) -> None:
431431
overrides["DEBUG"] = self._debug
432432

433433
overrides["MEDIA_ROOT"] = str(self._media_directory)
434+
434435
if self._static_directory is not None:
436+
# collect static files to this directory
435437
overrides["STATIC_ROOT"] = str(self._static_directory)
438+
# collect static files from here
439+
# Replace STATICFILES_DIRS to point only to the pre-collected directory in the Ansys installation.
440+
source_static_dir = (
441+
self._ansys_installation / f"nexus{self._ansys_version}" / "django" / "static"
442+
)
443+
if not source_static_dir.exists():
444+
raise ImproperlyConfiguredError(
445+
f"The static files directory '{source_static_dir}' does not exist in the installation. "
446+
"Please check your Ansys installation and version."
447+
)
448+
overrides["STATICFILES_DIRS"] = [str(source_static_dir)]
436449

437450
# relative URLs: By default, ADR serves static files from the URL /static/
438451
# and media files from the URL /media/. These can be changed using the

0 commit comments

Comments
 (0)