summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Roelli <charles@adnoto.net>2026-02-06 10:33:44 +0100
committerCharles Roelli <charles@adnoto.net>2026-02-06 10:33:44 +0100
commitada1d675ddda548800307f48a14a95062ced7efa (patch)
tree837102b2be3efcc97ab4ff444f213d29912f8a7f
parent951800fd37c5f77df8a011787be184de2731836d (diff)
Document all features, new output-directory option
-rw-r--r--README.md19
-rw-r--r--src/hatch_django_collectstatic/plugin.py2
2 files changed, 18 insertions, 3 deletions
diff --git a/README.md b/README.md
index 317ca1f..53a8253 100644
--- a/README.md
+++ b/README.md
@@ -3,9 +3,9 @@
Collect a django project's static files into its binary distribution
archive.
-Example usage:
+Example usage in `pyproject.toml`:
-```
+```toml
[build-system]
requires = ["hatchling >= 1.26", "hatch-django-collectstatic"]
build-backend = "hatchling.build"
@@ -13,6 +13,21 @@ build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel.hooks.django-collectstatic]
settings = "my_django_package.project.settings"
+# If you have installed Django apps from packages besides Django,
+# you'll need to enable the require-runtime-dependencies feature of
+# hatch in order to make these packages available when collecting
+# static files.
+# Default value of require-runtime-dependencies = false
+# require-runtime-dependencies = true
+
+# Output directory where static files are collected in the target.
+# Default value of output-directory = "static"
+# output-directory = "custom-static-directory"
+
[tool.hatch.build.targets.wheel.shared-data]
+# Mapping from output directory to the distribution path. The
+# following configuration will place the files in the .data directory
+# of the wheel, under "data/share/static".
+# See https://packaging.python.org/en/latest/specifications/binary-distribution-format/#the-data-directory
"static" = "share/static"
```
diff --git a/src/hatch_django_collectstatic/plugin.py b/src/hatch_django_collectstatic/plugin.py
index 5f3ba68..ec3c4dd 100644
--- a/src/hatch_django_collectstatic/plugin.py
+++ b/src/hatch_django_collectstatic/plugin.py
@@ -18,7 +18,7 @@ class DjangoCollectstaticBuildHook(BuildHookInterface):
settings.configure(
INSTALLED_APPS=project_settings.INSTALLED_APPS,
- STATIC_ROOT="static",
+ STATIC_ROOT=self.config.get("output-directory", "static"),
STATIC_URL=project_settings.STATIC_URL,
)
setup()