Source code for ferrosoft.apps.ferrobase.services.static_files
# Copyright (c) 2024 Ferrosoft GmbH. All rights reserved.
from django.contrib.staticfiles import finders
[docs]
def static_file_name(app_name: str, file_name: str) -> str:
"""Find static file inside emiflow app.
Raises:
RuntimeError if the file is not found.
"""
full_name = "%s/%s" % (app_name, file_name)
abs_name = finders.find(full_name)
if abs_name is None:
raise RuntimeError("Static file not found: %s" % full_name)
return abs_name