推送到Heroku后Rails 4资产管道出现问题

时间:2016-06-10 14:46:12

标签: javascript css ruby-on-rails ruby-on-rails-4 heroku

我是rails的新手,这是我已经部署到heroku的第三个项目,但还没有遇到过这个问题。推送到heroku后,我的应用程序没有在本地和实时加载JS和CSS文件。我收到此错误消息Failed to load resource: the server responded with a status of 404 (Not Found)

这是我的application.html.erb文件

<!DOCTYPE html>
<html>
  <head>
    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
    <%= csrf_meta_tags %>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/agency.css" rel="stylesheet">
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
    <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
    <link href='https://fonts.googleapis.com/css?family=Kaushan+Script' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700' rel='stylesheet' type='text/css'>

  </head>

  <body id="page-top" class="index">

    <%= yield %>

    <script src="js/jquery.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
    <script src="js/classie.js"></script>
    <script src="js/cbpAnimatedHeader.js"></script>
    <script src="js/jqBootstrapValidation.js"></script>
    <script src="js/contact_me.js"></script>
    <script src="js/agency.js"></script>

  </body>

</html>

我试过要求application.js文件中的js文件

//= require jquery
//= require jquery_ujs
//= require turbolinks

//= require agency
//= require bootstrap
//= require bootstrap.min
//= require cbpAnimatedHeader
//= require cbpAnimatedHeader.min
//= require classie
//= require contact_me
//= require jqBootstrapValidation

我在网上找到的一个常见问题是在config / environments / production.rb中将资产预编译器更改为true

  config.assets.compile = true

我不确定我是否忘记了任何可能有用的代码但是这个代码让我迷失了!

0 个答案:

没有答案