Skip to content
Snippets Groups Projects
Unverified Commit a928a2ff authored by Ed Morley's avatar Ed Morley Committed by GitHub
Browse files

Fix parsing of DISABLE_COLLECTSTATIC env var values (#1208)

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.
parent 1cc43fe9
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment