Sumit Sumit - 8 months ago 25
Python Question

How to instruct Heroku NOT to run collectstatic automatically on deploy?

I have a Django-based project on GitHub that I'd like everyone to be able to deploy using the one-click deploy button. It does not use the


I have the following
file at the root of the project:

"name": "Django project",
"description": "A hello world Django-based project",
"repository": "",
"keywords": ["python", "django"],
"scripts": {
"postdeploy": "python migrate --noinput"
"addons": [
"success_url": "/",
"env": {
"description": "A randomly generated secret to secure your Django installation.",
"generator": "secret"

The problem is, even though I don't have
in the list of
, Heroku automatically runs
python collectstatic --noinput
when someone tries to deploy my app, causing the build to fail.

How do I instruct Heroku NOT to run
on deploy?


Just add "DISABLE_COLLECTSTATIC": { "value": "1" } to your env object in your app.json, like so:

"env": {
    "description": "Don't run python collectstatic --noinput on deploy",
    "value": "1"

Also, if you have an existing Heroku app that you want to disable static collection from, run heroku config:set DISABLE_COLLECTSTATIC=1.