mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Plugin static files fix (#7532)
* Improve logging messages * Refactor * Re-add import - Weird?
This commit is contained in:
parent
f67147587a
commit
b924530627
@ -38,11 +38,12 @@ def collect_plugins_static_files():
|
|||||||
logger.info('Collecting static files for all installed plugins.')
|
logger.info('Collecting static files for all installed plugins.')
|
||||||
|
|
||||||
for slug in registry.plugins.keys():
|
for slug in registry.plugins.keys():
|
||||||
copy_plugin_static_files(slug)
|
copy_plugin_static_files(slug, check_reload=False)
|
||||||
|
|
||||||
|
|
||||||
def copy_plugin_static_files(slug):
|
def copy_plugin_static_files(slug, check_reload=True):
|
||||||
"""Copy static files for the specified plugin."""
|
"""Copy static files for the specified plugin."""
|
||||||
|
if check_reload:
|
||||||
registry.check_reload()
|
registry.check_reload()
|
||||||
|
|
||||||
plugin = registry.get_plugin(slug)
|
plugin = registry.get_plugin(slug)
|
||||||
@ -50,7 +51,7 @@ def copy_plugin_static_files(slug):
|
|||||||
if not plugin:
|
if not plugin:
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.info("Copying static files for plugin '%s'")
|
logger.info("Copying static files for plugin '%s'", slug)
|
||||||
|
|
||||||
# Get the source path for the plugin
|
# Get the source path for the plugin
|
||||||
source_path = plugin.path().joinpath('static')
|
source_path = plugin.path().joinpath('static')
|
||||||
@ -86,7 +87,7 @@ def copy_plugin_static_files(slug):
|
|||||||
with item.open('rb') as src:
|
with item.open('rb') as src:
|
||||||
staticfiles_storage.save(destination_path, src)
|
staticfiles_storage.save(destination_path, src)
|
||||||
|
|
||||||
logger.debug(f'- copied {item} to {destination_path}')
|
logger.debug('- copied %s to %s', str(item), str(destination_path))
|
||||||
copied += 1
|
copied += 1
|
||||||
|
|
||||||
logger.info(f"Copied %s static files for plugin '%s'.", copied, slug)
|
logger.info(f"Copied %s static files for plugin '%s'.", copied, slug)
|
||||||
|
Loading…
Reference in New Issue
Block a user