我正在将某人的python项目导入rails并且在使galleria.js图库插件工作时遇到一些麻烦。一切似乎都在本地,但是当我部署到heroku时,网站根本不会加载,即“我们很抱歉,但出了点问题。”该插件在本地正常工作。
我们将从application.html.erb
中的galleria加载标记开始 Galleria.loadTheme('<%= javascript_path('galleria.cinekine.js') %>');
我的js目录看起来像
javascripts/application.js`
javascripts/app.js.coffee`
javascripts/galleria.cinekine.js
javascripts/galleria.js
我的.scss看起来像
*
*= require_self
*/
@import 'bourbon';
@import 'meyer';
@import 'sfm';
@import 'apps';
@import 'galleria.cinekine';
我已经配置了application.rb
config.assets.enabled = true
我相对肯定heroku在预编译galleria.cinekine.js文件时遇到问题,因为heroku logs
的相关输出是
eb.1]: Rendered layouts/_footer.html.haml (1.5ms)
2012-10-02T04:36:05+00:00 app[web.1]: Completed 500 Internal Server Error in 106ms
2012-10-02T04:36:05+00:00 app[web.1]:
2012-10-02T04:36:05+00:00 app[web.1]: app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb___1858155475977362126_43698200'
2012-10-02T04:36:05+00:00 app[web.1]: ActionView::Template::Error (galleria.cinekine.js isn't precompiled):
2012-10-02T04:36:05+00:00 app[web.1]:
2012-10-02T04:36:05+00:00 app[web.1]: 21: autoplay: 5000,
2012-10-02T04:36:05+00:00 app[web.1]: 15: <%= yield %>
2012-10-02T04:36:05+00:00 app[web.1]: 16: <%= render 'layouts/footer' %>
所有这些都非常有趣,因为当我推动它时,heroku告诉我预编译在控制台中是可以的。
思考?作为alwasy,StackFoo非常感谢。
application.js的内容
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
//= require galleria
答案 0 :(得分:1)
您的所有JS都被预编译到一个文件中,大概是application.js
,因此您不能在页面上包含JS文件的非预编译版本,除非您将其添加到{{1} }:
config/environments/production.rb