Skip to content

Docs: Portable schema exporter example is missing Django bootstrap steps #540

@bctiemann

Description

@bctiemann

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:

  1. ImproperlyConfigured: Requested setting FIELD_CHOICES, but settings are not configured.DJANGO_SETTINGS_MODULE is not set.
  2. 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.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions