奇怪的部署问题,Django和CoffeeScript到Heroku [英] Weird deployment issue with Django and CoffeeScript to Heroku

查看:151
本文介绍了奇怪的部署问题,Django和CoffeeScript到Heroku的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个复杂的问题,所以需要一点解释。我不是寻找一个直接的答案,所以任何建议是好的。我有一个使用大量CoffeeScript的Django应用程序。要在项目中编译CoffeeScript,我使用的是应用程序 django-compressor 。要使用 django-compressor ,我需要安装 nmp (节点包管理器)。很抱歉,我无法在Heroku上安装 npm 。因此,我需要先编译CoffeeScript,然后再打开Heroku服务器。所以我通过设置 Fabric 看起来很好。

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.

我遇到了问题no因为我可以将编译好的CoffeeScript作为静态文件,但是模板中仍然有 {%compress js%} *** {%endcompress%} 标记,因为 django-compressor 在运行时之前不会重新生成新模板。

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.

因此,我正在寻找如何部署应用程序的建议以获得模板标签的乘法,使应用程序可以部署在Heroku上。我知道这是一个有很多部分的问题,所以任何一条建议都将是超级有帮助的!

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!

推荐答案

一个老问题 - 偶尔碰到
在这种情况下,这里是处理的方式:

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

这篇关于奇怪的部署问题,Django和CoffeeScript到Heroku的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆