Weird deployment issue with Django and CoffeeScript to Heroku

删除回忆录丶 提交于 2019-12-12 12:15:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!