问题
This is sort of a complex question so it will take a bit to explain. I'm not looking for a direct answer so any advice would be good. I have a Django app that uses a lot of CoffeeScript. To compile the CoffeeScript in the project I am using the app django-compressor
. To use django-compressor
I need to install nmp
(node package manager). Unfortunately, I can't install npm
on Heroku. Thus, I need to compile the CoffeeScript before it hits the Heroku servers. So I did that by setting up Fabric
which is seeming to work well.
I am running into a problem no because I can get the compiled CoffeeScript as a static file but the templates still have the {% compress js %} *** {% endcompress %}
tags in them because django-compressor
does not regenerate new templates until run time.
Thus I am looking for advice on how to deploy the app to get ride of the template tags so that the app can be deployed on Heroku. I know it is a question with a lot of parts so any piece of advice would be super helpful!
回答1:
I realize it's quite an old question - hit it occasionally Just in case, here's the way to deal:
http://django_compressor.readthedocs.org/en/latest/usage/#pre-compression
http://django_compressor.readthedocs.org/en/latest/scenarios/#offline-compression
回答2:
you could also commit the manifest.json file that django compressor generates (I'm assuming you're using it in offline mode) and then it will know which template blocks go to which compiled js/css files
来源:https://stackoverflow.com/questions/9392993/weird-deployment-issue-with-django-and-coffeescript-to-heroku