Skip to content
  • Ed Morley's avatar
    a928a2ff
    Fix parsing of DISABLE_COLLECTSTATIC env var values (#1208) · a928a2ff
    Ed Morley authored
    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.
    a928a2ff
    Fix parsing of DISABLE_COLLECTSTATIC env var values (#1208)
    Ed Morley authored
    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.
Loading