Skip to content

Commit be0ede2

Browse files
authored
Document installation step with pdm
PDM does not have pip in the virtualenv by default. The `tailwind init` command will try to install `cookiecutter` automatically. Let's mention that explicitly in the installation steps.
1 parent 95b5a78 commit be0ede2

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

docs/installation.md

+18-9
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,23 @@
3737
python manage.py tailwind init
3838
```
3939

40+
If you are using [pdm](https://pdm-project.org/), you might need to ensure `pip` is installed in your virtualenv:
41+
42+
```bash
43+
pdm run python -m ensurepip
44+
```
45+
46+
See [pdm's documentation](https://pdm-project.org/en/latest/usage/venv/#including-pip-in-your-virtual-environment)
47+
for more information.
48+
4049
> Note: By default, we create an app compatible with Tailwind CSS version 4. If you want to create an app compatible
4150
> with Tailwind CSS version 3, you can use the `--tailwind-version 3` flag:
4251
4352
```bash
4453
python manage.py tailwind init --tailwind-version 3
4554
```
4655

47-
4. Add your newly created `'theme'` app to `INSTALLED_APPS` in `settings.py`:
56+
5. Add your newly created `'theme'` app to `INSTALLED_APPS` in `settings.py`:
4857

4958
```python
5059
INSTALLED_APPS = [
@@ -54,13 +63,13 @@
5463
]
5564
```
5665

57-
5. Register the generated `'theme'` app by adding the following line to `settings.py`:
66+
6. Register the generated `'theme'` app by adding the following line to `settings.py`:
5867

5968
```python
6069
TAILWIND_APP_NAME = 'theme'
6170
```
6271

63-
6. Install *Tailwind CSS* dependencies by running the following command:
72+
7. Install *Tailwind CSS* dependencies by running the following command:
6473

6574
```bash
6675
python manage.py tailwind install
@@ -72,10 +81,10 @@
7281
python manage.py tailwind install --no-package-lock
7382
```
7483
75-
7. The *Django Tailwind* comes with a simple `base.html` template located at
84+
8. The *Django Tailwind* comes with a simple `base.html` template located at
7685
`your_tailwind_app_name/templates/base.html`. You can always extend or delete it if you already have a layout.
7786
78-
8. If you are not using the `base.html` template that comes with *Django Tailwind*, add `{% tailwind_css %}` to
87+
9. If you are not using the `base.html` template that comes with *Django Tailwind*, add `{% tailwind_css %}` to
7988
your `base.html` template:
8089
8190
```html
@@ -90,7 +99,7 @@
9099
91100
The `{% tailwind_css %}` tag includes Tailwind's stylesheet.
92101

93-
9. Let's also add and configure `django_browser_reload`, which takes care of automatic page and CSS refreshes in
102+
10. Let's also add and configure `django_browser_reload`, which takes care of automatic page and CSS refreshes in
94103
development mode. Add it to `INSTALLED_APPS` in `settings.py`:
95104
96105
```python
@@ -102,7 +111,7 @@
102111
]
103112
```
104113
105-
10. Staying in `settings.py`, add the middleware:
114+
11. Staying in `settings.py`, add the middleware:
106115
107116
```python
108117
MIDDLEWARE = [
@@ -115,7 +124,7 @@
115124
The middleware should be listed after any that encode the response, such as Django’s `GZipMiddleware`. The
116125
middleware automatically inserts the required script tag on HTML responses before `</body>` when `DEBUG` is `True`.
117126
118-
11. Include `django_browser_reload` URL in your root `urls.py`:
127+
12. Include `django_browser_reload` URL in your root `urls.py`:
119128
120129
```python
121130
from django.urls import include, path
@@ -125,7 +134,7 @@
125134
]
126135
```
127136
128-
12. Finally, you should be able to use *Tailwind CSS* classes in HTML. Start the development server by running the
137+
13. Finally, you should be able to use *Tailwind CSS* classes in HTML. Start the development server by running the
129138
following command in your terminal:
130139
131140
```bash

0 commit comments

Comments
 (0)