Apps Reference¶
Module Summary¶
next.apps contains the Django AppConfig and the helpers that the framework runs at application startup.
NextFrameworkConfig.ready() first runs next.checks.register_all() to register the framework system checks.
It then calls four installer hooks in a fixed order: autoreload.install(), templates.install(), staticfiles.install(), and components.install().
Public API¶
Django app configuration for next-dj framework.
- class next.apps.NextFrameworkConfig(app_name, app_module)[source]¶
Connect autoreload, template tag builtins, and filesystem watches.
- name = 'next'¶
- verbose_name = 'Next Django Framework'¶
Template Tag Registration¶
Register next-dj templatetag modules as Django template builtins.
Staticfiles Integration¶
Register next-dj’s static files finder and built-in asset kinds.
- next.apps.staticfiles.install() None[source]¶
Wire the staticfiles finder and register the framework’s built-in asset kinds.
Adds NextStaticFilesFinder to STATICFILES_FINDERS once and populates the public KindRegistry and PlaceholderRegistry with framework-shipped defaults through the same API user code uses. Both steps are idempotent so the function is safe under settings reloads or re-entrant ready calls.
staticfiles.install() calls next.static.register_defaults to register the built-in css, js, and module kinds and the styles and scripts slots.
Autoreload Installer¶
The two installer submodules below are called exclusively from NextFrameworkConfig.ready and are not part of the project-level public API.
They are documented here for framework contributors and for projects that instrument startup behaviour.
Patch Django’s autoreload to use next-dj’s reloader and watch specs.
Django does not expose a setting for overriding the reloader class, so this module still swaps autoreload.StatReloader. The swap is kept idempotent and records the class it replaces so tests (or other packages) can restore it. A warning is logged if another library has replaced StatReloader with a class that is not a StatReloader subclass, which suggests an incompatible override and makes our patch unsafe to apply.
- next.apps.autoreload.install() None[source]¶
Swap StatReloader for NextStatReloader and wire watch specs.
Safe to call more than once: subsequent calls are no-ops once the current autoreload.StatReloader is already our subclass or one of its descendants.
- next.apps.autoreload.uninstall() None[source]¶
Restore the previous StatReloader class if install() swapped it.
install() swaps Django’s StatReloader for NextStatReloader and connects the autoreload_started signal so the framework’s watch specs are registered at dev-server startup.
uninstall() restores the original StatReloader subclass.
Test suites that call ready() multiple times use it to avoid double-patching.
Components Installer¶
Bootstrap component backends so their components are discovered on app ready.
- next.apps.components.install() None[source]¶
Load backends and run component discovery on app ready.
Discovery populates each backend registry. Unless LAZY_COMPONENT_MODULES is set it also imports every component.py so decorators run before the first request.
install() loads the component backends and populates their registries.
Unless LAZY_COMPONENT_MODULES is true it also imports every discovered component.py.
See Component Pipeline for the discovery and load sequence.
See Also¶
See also
Project Layout for the application setup.
Extending for the extension surface.
Internals Overview for the full ready() sequence, including system-check registration and the four installer hooks.