(Cloud9)应用程序在本地服务器上运行正常,但在heroku上运行不正常

时间:2017-11-19 14:56:36

标签: ruby-on-rails heroku cloud9

该应用程序在本地服务器上运行良好,但一旦在heroku上部署,它就会丢失其格式并失去其功能。我包括本地服务器和heroku的图片。 我很沮丧,不知道该怎么做,即使在db:migrate之后我运行了heroku restart。仍然没有运气!!!

This is my Heroku Log: 
    -----> Ruby app detected
    -----> Compiling Ruby/Rails
    -----> Using Ruby version: ruby-2.3.4
    -----> Installing dependencies using bundler 1.15.2
           Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
           Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.0). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
           Fetching gem metadata from https://rubygems.org/..........
           Fetching version metadata from https://rubygems.org/..
           Fetching dependency metadata from https://rubygems.org/.
           Using rake 12.2.1
           Using concurrent-ruby 1.0.5
           Using json 1.8.6
           Using minitest 5.10.3
           Using thread_safe 0.3.6
           Using builder 3.2.3
           Using erubis 2.7.0
           Using mini_portile2 2.3.0
           Using crass 1.0.2
           Using rack 1.6.8
           Using mini_mime 0.1.4
           Using arel 6.0.4
           Using execjs 2.7.0
           Using rb-fsevent 0.10.2
           Using ffi 1.9.18
           Using bundler 1.15.2
           Using coffee-script-source 1.12.2
           Using thor 0.20.0
           Using multi_json 1.12.2
           Using pg 0.21.0
           Using rails_serve_static_assets 0.0.5
           Using rails_stdout_logging 0.0.5
           Using rdoc 4.3.0
           Using tilt 2.0.8
           Using turbolinks-source 5.0.3
           Using i18n 0.9.1
           Using tzinfo 1.2.4
           Using nokogiri 1.8.1
           Using rack-test 0.6.3
           Using sprockets 3.7.1
           Using mail 2.7.0
           Using autoprefixer-rails 7.1.6
           Using uglifier 3.2.0
           Using coffee-script 2.4.1
           Using rb-inotify 0.9.10
           Using rails_12factor 0.0.3
           Using activesupport 4.2.5
           Using sdoc 0.4.2
           Using loofah 2.1.1
           Using turbolinks 5.0.1
           Using sass-listen 4.0.0
           Using rails-deprecated_sanitizer 1.0.3
           Using globalid 0.4.1
           Using activemodel 4.2.5
           Using jbuilder 2.7.0
           Using rails-html-sanitizer 1.0.3
           Using sass 3.5.3
           Using rails-dom-testing 1.0.8
           Using activerecord 4.2.5
           Using activejob 4.2.5
           Using actionview 4.2.5
           Using bootstrap-sass 3.3.7
           Using actionpack 4.2.5
           Using actionmailer 4.2.5
           Using railties 4.2.5
           Using sprockets-rails 3.2.1
           Using coffee-rails 4.1.1
           Using jquery-rails 4.3.1
           Using rails 4.2.5
           Using sass-rails 5.0.6
           Bundle complete! 15 Gemfile dependencies, 60 gems now installed.
           Gems in the groups development and test were not installed.
           Bundled gems are installed into ./vendor/bundle.
           The latest bundler is 1.16.0, but you are currently running 1.15.2.
           To update, run `gem install bundler`
           Bundle completed (2.66s)
           Cleaning up the bundler cache.
           Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.0). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
           The latest bundler is 1.16.0, but you are currently running 1.15.2.
           To update, run `gem install bundler`
    -----> Installing node-v6.11.1-linux-x64
           Detected manifest file, assuming assets were compiled locally
    ###### WARNING:
           No Procfile detected, using the default web server.
           We recommend explicitly declaring how to boot your server process via a Procfile.
           https://devcenter.heroku.com/articles/ruby-default-web-server
    -----> Discovering process types
           Procfile declares types     -> (none)
           Default types for buildpack -> console, rake, web, worker
    -----> Compressing...
           Done: 40.9M
    -----> Launching...
           Released v19
           https://xiaolong-blog.herokuapp.com/ deployed to Heroku

这是我的Gemfile,         的Gemfile:         来源' https://rubygems.org'         ruby' 2.3.4'

    # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
    gem 'rails', '4.2.5'
    # Use sqlite3 as the database for Active Record

    # Use SCSS for stylesheets
        gem 'bootstrap-sass', '~> 3.3.7'
    gem 'sass-rails', '~> 5.0'
    # Use Uglifier as compressor for JavaScript assets
        gem 'uglifier', '>= 1.3.0'
    # Use CoffeeScript for .coffee assets and views
        gem 'coffee-rails', '~> 4.1.0'
    # See https://github.com/rails/execjs#readme for more supported runtimes
    # gem 'therubyracer', platforms: :ruby

    # Use jquery as the JavaScript library
        gem 'jquery-rails'
    # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
        gem 'turbolinks'
    # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
        gem 'jbuilder', '~> 2.0'
    # bundle exec rake doc:rails generates the API under doc/api.
        gem 'sdoc', '~> 0.4.0', group: :doc

    # Use ActiveModel has_secure_password
    # gem 'bcrypt', '~> 3.1.7'

    # Use Unicorn as the app server
    # gem 'unicorn'

    # Use Capistrano for deployment
    # gem 'capistrano-rails', group: :development

        group :development, :test do
          gem 'sqlite3'
      # Call 'byebug' anywhere in the code to stop execution and get a debugger console
          gem 'byebug'
        end

    group :development do
      # Access an IRB console on exception pages or by using <%= console %> in views
          gem 'web-console', '~> 2.0'

      # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
          gem 'spring'
        end

     group :production do
           gem 'pg'
           gem 'rails_12factor'
         end

1 个答案:

答案 0 :(得分:0)

附近添加
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"> </script>
</head>

Runon终端:

RAILS_ENV=production bundle exec rake assets:precompile