Alexis Alexis - 1 year ago 132
CoffeeScript Question

Creating an app on Heroku with Django and NPM

I'm writing a Django app that includes some CoffeeScript in it. To allow for this I'm using django-compressor which compiles the CoffeeScript to JS before the app is launched. django-compressor requires that NPM is installed on the machine to compile the CoffeeScript.

Now I want to deploy this app on Heroku. I can't put npm in my

so I am wondering how I can get npm on the Heroku server?

Answer Source

Note: The multi buildpack is a much nicer way to accomplish this these days :)

I've created a fork of the official Python heroku buildpack that allows an optional npm_requirements.txt for installing such dependencies.

I am now using coffeescript and less-css with django-compressor on heroku :)

Edit: To switch to my buildback from the standard buildpack:

  1. use the heroku command line app to set the BUILDPACK_URL environment variable:

    heroku config:add BUILDPACK_URL=git:// 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download