Plugin serializers won't be loaded without API #14747
Unanswered
alehaa
asked this question in
Help Wanted!
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Deployment Type
Self-hosted
NetBox Version
v3.7.0
Python Version
3.11
Steps to Reproduce
Expected Behavior
As serializers have been added in
api/serializers.py, these should be loaded and used. Creating an object should be possible now.Observed Behavior
NetBox gives an error 500 and doesn't create the new object in the database. It gives the following traceback:
After some debugging it seems, NetBox refuses to load the
api/serializers.pyfile on its own. Utilizing NetBox Shell, I can verify this file is not loadable standalone.Workaround
Adding an
importstatement in the previously empty__init__.pyfile resolves the issue for me:Assumption
I think this might be some kind of dependency issue. Usually, when API endpoints will be deployed,
api/urls.pyis loaded first, which might loadapi/views.pyand finallyapi/serializers.py, where in this order no errors are known from other plugin developers. However, when these are missing, maybe some dependencys for importing are not met?Beta Was this translation helpful? Give feedback.
All reactions