I have broken down the issues with plugin static files into multiple smaller ones:
If an AppMixin
plugin before had a static
folder and the django app was loaded, invoke static
had already collected the static files in the root of the static folder so a file in my-plugin/static/panel.js
was served by /static/panel.js
.
(to remove clashes between files with the same name from multiple plugins, I placed my static files in my-plugin/static/my-plugin/panel.js
, so it was served by /static/my-plugin/panel.js
)
Now after the mentioned PR, a file in my-plugin/static/panel.js
is served by /static/plugins/my-plugin/panel.js
. I do not think this change is bad, it just needs to be documented as breaking. One good think would be to provide a {% plugin_static "panel.js" %}
template tag which resolves to the particular plugin static url (/static/plugins/my-plugin/panel.js
) and we back port that to 0.15 which resolves to /static/panel.js
I can reproduce this in a fresh docker setup (but not in my dev setup running locally). But no idea why only in a production docker setup. (Sometimes only very few times it actually succeeds, but then the migrations are run two times, the first time without any error, and the second they error out, because obviously the table already exists, that the migrations should create). Maybe that's some type of race condition.
inventree-bulk-plugin
(or inventree-kicad
, but that only tests with migrations)inventree-worker | Plugin registry has no record of plugin 'inventree-bulk-plugin'
static/plugins/inventree-bulk-plugin
does not exist (folder should exist)invoke update
the files now exists and the migrations have runWhen deactivating a plugin, the static files get don't removed automatically, a invoke static
is needed. And even then, nested folders remain.
(If 2 is solved, found with my local dev setup where I don't have the issue 2, or when running invoke static
)
Process-c8d4a6053e4d446fb9f81077681a7693 processing blue-snake-xray-beryllium 'plugin.staticfiles.copy_plugin_static_files'
Copying static files for plugin 'inventree-bulk-plugin'
Failed 'plugin.staticfiles.copy_plugin_static_files' (blue-snake-xray-beryllium) - [Errno 66] Directory not empty: '/Users/wolflu/Development/1_GITHUB/InvenTree/dev/static/inventree-bulk-plugin' : Traceback (most recent call last):
File "/Users/wolflu/Development/1_GITHUB/InvenTree/dev/venv/lib/python3.11/site-packages/django_q/worker.py", line 97, in worker
res = f(*task["args"], **task["kwargs"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/wolflu/Development/1_GITHUB/InvenTree/src/backend/InvenTree/plugin/staticfiles.py", line 66, in copy_plugin_static_files
clear_static_dir(destination_prefix)
File "/Users/wolflu/Development/1_GITHUB/InvenTree/src/backend/InvenTree/plugin/staticfiles.py", line 31, in clear_static_dir
staticfiles_storage.delete(d)
File "/Users/wolflu/Development/1_GITHUB/InvenTree/dev/venv/lib/python3.11/site-packages/django/core/files/storage/filesystem.py", line 156, in delete
os.rmdir(name)
OSError: [Errno 66] Directory not empty: '/Users/wolflu/Development/1_GITHUB/InvenTree/dev/static/inventree-bulk-plugin'
When freshly installing a plugin (freshly, not previously installed), and then activating the plugin without restarting the server it can happen that it looks like this:
Traceback (most recent call last):
File "/root/.local/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/inventree/src/backend/InvenTree/plugin/api.py", line 341, in get
settings_definition=settings, plugin=plugin.plugin_config()
^^^^^^^^^^^^^^^^^^^^^^
TypeError: MetaBase.plugin_config() missing 1 required positional argument: 'self'
# Version Information:
InvenTree-Version: 0.17.0 dev
Django Version: 4.2.15
Commit Hash: cc45c23
Commit Date: 2024-08-30
Database: postgresql
Debug-Mode: False
Deployed using Docker: True
Platform: Linux-6.6.31-linuxkit-x86_64-with
Installer: DOC
Active plugins: [{'name': 'InvenTreeBarcode', 'slug': 'inventreebarcode', 'version': '2.1.0'}, {'name': 'InvenTreeCoreNotificationsPlugin', 'slug': 'inventreecorenotificationsplugin', 'version': '1.0.0'}, {'name': 'InvenTreeCurrencyExchange', 'slug': 'inventreecurrencyexchange', 'version': '1.0.0'}, {'name': 'InvenTreeLabel', 'slug': 'inventreelabel', 'version': '1.1.0'}, {'name': 'InvenTreeLabelMachine', 'slug': 'inventreelabelmachine', 'version': '1.0.0'}, {'name': 'InvenTreeLabelSheet', 'slug': 'inventreelabelsheet', 'version': '1.0.0'}, {'name': 'DigiKeyPlugin', 'slug': 'digikeyplugin', 'version': '1.0.0'}, {'name': 'LCSCPlugin', 'slug': 'lcscplugin', 'version': '1.0.0'}, {'name': 'MouserPlugin', 'slug': 'mouserplugin', 'version': '1.0.0'}, {'name': 'TMEPlugin', 'slug': 'tmeplugin', 'version': '1.0.0'}]
No response
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too