You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Automatic Django static asset generation (running the manage.py collectstatic command) was added in #108.
At the moment there is no way to force disable the feature (beyond removing django.contrib.staticfiles from INSTALLED_APPS in the app's Django config, or removing the manage.py script), whereas the classic Python buildpack allows disabling it using DISABLE_COLLECTSTATIC=1.
That said, the new implementation performs more thorough checks to see whether the app is using the static files feature, so between that and a few other improvements (like now passing env vars to the subprocess), there should be fewer cases where the feature needs manually disabling.
Some scenarios in which the ability to disable might be needed:
the user needs to run a step between Python package installation and running collectstatic (such as patching invalid urls in CSS comments to work around https://code.djangoproject.com/ticket/21080)
the user can't debug a failure locally or at build time, and wants the build to succeed so they can debug at runtime
If we decide we should still add support for disabling automatic Django static asset generation, then we should probably use config options in project.toml rather than env vars (to encourage infrastructure as code). However, this depends on us figuring out a convention there for all of our buildpacks.
Either way, we'll also need to add deprecation (or error) messages if DISABLE_COLLECTSTATIC is set (or if .heroku/collectstatic_disabled exists), to warn that it no longer does anything (for people migrating from the classic buildpack).
The classic Heroku Python buildpack automatically runs the Django
`collectstatic` command:
https://github.com/heroku/heroku-buildpack-python/blob/main/bin/steps/collectstatic
This adds equivalent support, with a couple of improvements:
- This implementation performs more checks to see whether the app is
actually using the static files feature before trying to run it
(reducing the number of cases where users would need to manually
disable it).
- The collectstatic symlink feature has been enabled, as requested in
heroku/heroku-buildpack-python#1060.
- Symlinked `manage.py` files are now supported, as requested in
heroku/heroku-buildpack-python#972.
- The error messages are finer grained/more useful.
- There are many more tests (including now testing legacy vs latest
Django versions, to check the CLI arguments used work for both ends of
the spectrum).
There is currently no way to force disable the feature (beyond removing
`django.contrib.staticfiles` from `INSTALLED_APPS` in the app's Django
config, or removing the `manage.py` script). Supporting this depends on
us deciding how best to handle buildpack options, so will be added
later, in #109.
The build log output and error messages are fairly reasonable already
(and a significant improvement over the classic buildpack), and will be
further polished as part of the future build output overhaul.
The implementation uses the new `utils::run_command_and_capture_output`
added in #106.
See:
* https://docs.djangoproject.com/en/4.2/howto/static-files/
* https://docs.djangoproject.com/en/4.2/ref/contrib/staticfiles/
* https://docs.djangoproject.com/en/4.2/ref/settings/#settings-staticfilesFixes#5.
GUS-W-9538294.
Automatic Django static asset generation (running the
manage.py collectstatic
command) was added in #108.At the moment there is no way to force disable the feature (beyond removing
django.contrib.staticfiles
fromINSTALLED_APPS
in the app's Django config, or removing themanage.py
script), whereas the classic Python buildpack allows disabling it usingDISABLE_COLLECTSTATIC=1
.That said, the new implementation performs more thorough checks to see whether the app is using the static files feature, so between that and a few other improvements (like now passing env vars to the subprocess), there should be fewer cases where the feature needs manually disabling.
Some scenarios in which the ability to disable might be needed:
If we decide we should still add support for disabling automatic Django static asset generation, then we should probably use config options in
project.toml
rather than env vars (to encourage infrastructure as code). However, this depends on us figuring out a convention there for all of our buildpacks.Either way, we'll also need to add deprecation (or error) messages if
DISABLE_COLLECTSTATIC
is set (or if.heroku/collectstatic_disabled
exists), to warn that it no longer does anything (for people migrating from the classic buildpack).GUS-W-14109400.
The text was updated successfully, but these errors were encountered: