Fix parsing of DISABLE_COLLECTSTATIC env var values#1208
Merged
Conversation
danielleadams
approved these changes
May 21, 2021
05c1e5b to
f751d5e
Compare
By default if Django is installed and a `manage.py` file found, the buildpack will run Django's `collectstatic` command at the end of the build. This step can be skipped by setting `DISABLE_COLLECTSTATIC=1`: https://devcenter.heroku.com/articles/django-assets#disabling-collectstatic However previously, if `DISABLE_COLLECTSTATIC` was instead set to `0` or the empty string (such as when toggling it on and off during debugging), then collectstatic would still be skipped. This behaviour was made more confusing due to there being no build output that explained why collectstatic was being skipped. Now: * Using values of `0` or the empty string are treated the same as if `DISABLE_COLLECTSTATIC` was not set at all (all other values are unaffected). * If `collectstatic` is skipped (either due to that env var, the legacy skip file, or because a `manage.py` file is not found), then the build output now contains the reason why. * A deprecation warning is output when collectstatic is skipped via the legacy `.heroku/collectstatic_disabled` file method. I've also added some more tests around collectstatic, since there was only one before, and refactored the collectstatic step script to use early returns for improved readability. See: https://heroku.support/950668 https://heroku.support/986549 Closes GUS-W-8813947.
f751d5e to
46625a3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By default if Django is installed and a
manage.pyfile found, the buildpack will run Django'scollectstaticcommand at the end of the build.This step can be skipped by setting
DISABLE_COLLECTSTATIC=1:https://devcenter.heroku.com/articles/django-assets#disabling-collectstatic
However previously, if
DISABLE_COLLECTSTATICwas instead set to0or the empty string (such as when toggling it on and off during debugging), then collectstatic would still be skipped.This behaviour was made more confusing due to there being no build output that explained why collectstatic was being skipped.
Now:
0or the empty string are treated the same as ifDISABLE_COLLECTSTATICwas not set at all (all other values are unaffected).collectstaticis skipped (either due to that env var, the legacy skip file, or because amanage.pyfile is not found), then the build output now contains the reason why..heroku/collectstatic_disabledfile method.I've also added some more tests around collectstatic, since there was only one before, and refactored the collectstatic step script to use early returns for improved readability.
See:
https://heroku.support/950668
https://heroku.support/986549
Closes GUS-W-8813947.