Heroku, a cloud solution for various application engines, supports django out of the box. It does a pretty good job of providing you with a deployment process which at one hand is relatively simple, and on the other hand allows them to control their resources.

In particular, Heroku handles the static files for you by running


command. However, if you happen to use






or some other additional manager for static files that needs to be executed prior to running the collection, Heroku won't do anything about it.

Fortunately, you can solve the problem by following the steps below.

First, add node-js build component:

heroku buildpacks:add --index 1 heroku/nodejs

Then, create a file called


which looks something like this:

  "engines": {
    "node": ">4.0.0"
  "dependencies": {
    "bower": ">=1.8.0"

This will force the deployment of both node.js and bower during your build on heroku.

Last, create a file called


in your repository. Make sure it's executable by calling

chmod 0755 bin/post_compile

. Put this inside it:


export PATH=/app/.heroku/node/bin:$PATH

python manage.py bower_install --no-color
python manage.py collectstatic --noinput

You can also disable the automatic heroku


invocation, because it loses its purpose. Run this command to achieve this:

heroku config:set DISABLE_COLLECTSTATIC 1

That's it! Obviously, now you can any other necessary custom steps in the


script, including running migrations.

Tags: None
Categories: None |

0 comments have been posted.

Your email: we will send you a confirmation link to this address to confirm your identity and to prevent robot posting
Get in touch
Join notification list

Join the email list to get notified about new posts and other updates

Follow updates

Join our social networks and RSS feed to keep up to date with latest news and publications