Skip to content

Commit addf415

Browse files
authored
Fixing correct path to staticfiles dirs (#56)
1 parent bdb97a6 commit addf415

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

docs/setup-django.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,11 @@ The configuration above will look for javascript files in the folder `your_app/j
133133

134134
If you add that folder to `STATICFILES_DIRS` in settings it will pick that compiled javascript and you can use it in templates.
135135

136-
```text
136+
```python
137+
from pathlib import Path
138+
BASE_DIR = Path.cwd()
137139
STATICFILES_DIRS = [
138-
("js", "/dist/js"),
140+
("js", f"{BASE_DIR}/dist/js"),
139141
]
140142
```
141143

tests/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
"""
44

55
import os
6+
from pathlib import Path
67

78
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
8-
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
9+
BASE_DIR = Path.cwd()
910
# SECURITY WARNING: keep the secret key used in production secret!
1011
SECRET_KEY = "a_not_so_secret_key"
1112

0 commit comments

Comments
 (0)