Skip to content

Commit ccc3941

Browse files
change ready hook to just autoconfiguration (#199)
1 parent 1f90357 commit ccc3941

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ and this project attempts to adhere to [Semantic Versioning](https://semver.org/
2424

2525
### Changed
2626

27-
- **Internal**: Refactored application initialization to use internal plugin instead of direct calls in `AppConfig.ready()`.
27+
- **Internal**: Refactored app initialization to use internal plugin for autoconfiguration instead of in `AppConfig.ready()`.
2828

2929
## [0.16.0]
3030

src/django_bird/apps.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ class DjangoBirdAppConfig(AppConfig):
1515

1616
@override
1717
def ready(self):
18+
from django_bird.components import components
1819
from django_bird.conf import app_settings
1920
from django_bird.plugins import pm
21+
from django_bird.staticfiles import asset_types
2022

23+
pm.hook.register_asset_types(register_type=asset_types.register_type)
24+
components.discover_components()
2125
for init_handler in pm.hook.ready(app_settings=app_settings):
2226
init_handler()

src/django_bird/conf.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,6 @@
1515
from ._typing import override
1616
from .utils import unique_ordered
1717

18-
19-
@hookimpl
20-
def ready(app_settings: AppSettings):
21-
from .components import components
22-
from .plugins import pm
23-
from .staticfiles import asset_types
24-
25-
app_settings.autoconfigure()
26-
pm.hook.register_asset_types(register_type=asset_types.register_type)
27-
components.discover_components()
28-
29-
3018
DJANGO_BIRD_SETTINGS_NAME = "DJANGO_BIRD"
3119

3220

@@ -55,6 +43,11 @@ def get_component_directory_names(self):
5543
return unique_ordered([*self.COMPONENT_DIRS, "bird"])
5644

5745

46+
@hookimpl
47+
def ready(app_settings: AppSettings):
48+
app_settings.autoconfigure()
49+
50+
5851
DJANGO_BIRD_BUILTINS = "django_bird.templatetags.django_bird"
5952
DJANGO_BIRD_FINDER = "django_bird.staticfiles.BirdAssetFinder"
6053

0 commit comments

Comments
 (0)