Alexis Alexis - 1 month ago 22
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

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

Answer

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 :)

https://github.com/jiaaro/heroku-buildpack-django

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://github.com/jiaaro/heroku-buildpack-django.git 
    
Comments