Change Type
Correction
Proposed Changes
The Exporting a Schema section of docs/portable-schema.md shows a Python snippet calling export_cots() but does not explain that Django must be fully bootstrapped before any NetBox or plugin code can be imported.
Users running the snippet as a standalone script hit one of two errors:
ImproperlyConfigured: Requested setting FIELD_CHOICES, but settings are not configured. — DJANGO_SETTINGS_MODULE is not set.
AppRegistryNotReady: Apps aren't loaded yet. — DJANGO_SETTINGS_MODULE is set but django.setup() is never called.
Reported in discussion #534.
Proposed fix: expand the section to show two usage paths — manage.py nbshell (zero setup, recommended) and a standalone .py with django.setup() called before any imports — plus an admonition explaining the AppRegistryNotReady error.
Change Type
Correction
Proposed Changes
The Exporting a Schema section of
docs/portable-schema.mdshows a Python snippet callingexport_cots()but does not explain that Django must be fully bootstrapped before any NetBox or plugin code can be imported.Users running the snippet as a standalone script hit one of two errors:
ImproperlyConfigured: Requested setting FIELD_CHOICES, but settings are not configured.—DJANGO_SETTINGS_MODULEis not set.AppRegistryNotReady: Apps aren't loaded yet.—DJANGO_SETTINGS_MODULEis set butdjango.setup()is never called.Reported in discussion #534.
Proposed fix: expand the section to show two usage paths —
manage.py nbshell(zero setup, recommended) and a standalone.pywithdjango.setup()called before any imports — plus an admonition explaining theAppRegistryNotReadyerror.