Skip to content

Commit 6dc47b4

Browse files
add note about autoconfig to README (#6)
1 parent b8d98d0 commit 6dc47b4

File tree

1 file changed

+57
-13
lines changed

1 file changed

+57
-13
lines changed

README.md

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,66 @@ High-flying components for perfectionists with deadlines.
2121

2222
1. Install the package from PyPI:
2323

24-
```bash
25-
python -m pip install django-bird
26-
# or
27-
uv add django-bird
28-
uv sync
29-
```
24+
```bash
25+
python -m pip install django-bird
26+
27+
# or if you like the new hotness
28+
29+
uv add django-bird
30+
uv sync
31+
```
3032

3133
2. Add the app to your Django project's `INSTALLED_APPS`:
3234
33-
```python
34-
INSTALLED_APPS = [
35-
...,
36-
"django_bird",
37-
...,
38-
]
39-
```
35+
```python
36+
INSTALLED_APPS = [
37+
...,
38+
"django_bird",
39+
...,
40+
]
41+
```
42+
43+
3. django-bird requires two settings in your `settings.TEMPLATES` to be configured to work properly:
44+
45+
- `django_bird.templatetags.django_bird` in the `builtins`
46+
- `django_bird.loader.BirdLoader` in the innermost list of `loaders`, before `django.template.loaders.filesystem.Loader` and `django.template.loaders.app_directories.Loader`
47+
48+
By default, these should be configured for you automatically. If you would like to disable this behavior and set this up yourself, you will need to set `DJANGO_BIRD["ENABLE_AUTO_CONFIG"] = False`.
49+
50+
```python
51+
# settings.py
52+
from pathlib import Path
53+
54+
55+
DJANGO_BIRD = {
56+
"ENABLE_AUTO_CONFIG": False,
57+
}
58+
59+
TEMPLATES = [
60+
{
61+
"BACKEND": "django.template.backends.django.DjangoTemplates",
62+
"DIRS": [
63+
Path(__file__).parent / "templates",
64+
],
65+
"OPTIONS": {
66+
"builtins": [
67+
"django_bird.templatetags.django_bird",
68+
],
69+
"loaders": [
70+
(
71+
"django.template.loaders.cached.Loader",
72+
[
73+
"django_bird.loader.BirdLoader",
74+
"django.template.loaders.filesystem.Loader",
75+
"django.template.loaders.app_directories.Loader",
76+
],
77+
),
78+
],
79+
},
80+
}
81+
]
82+
83+
```
4084
4185
## Getting Started
4286

0 commit comments

Comments
 (0)