我在gemfile和config / application.rb文件中进行了一些操作后,将我的应用程序推送到了heroku
我在我的Bundler.require上方的application.rb文件中有config.assets.initialize_on_precompile = false
。
这是gemfile。
source 'https://rubygems.org'
ruby '2.1.0'
gem 'rails', '4.0.5'
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
gem 'sass-rails', '~> 4.0.2'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
gem 'bcrypt', '~> 3.1.7'
group :test, :development do
gem "rspec-rails", "2.13.1"
end
group :test do
gem "capybara", "2.1.0"
end
group :development do
gem 'pry-rails'
gem 'nokogiri', '1.6.3.1'
end
当我尝试访问heroku上的应用程序时,我得到了:
'应用程序错误 应用程序中发生错误,无法提供您的页面。请稍后再试。
如果您是应用程序所有者,请查看日志以获取详细信息。'
有什么想法吗?
编辑:Application.rb根据要求发布在下面:
require File.expand_path('../boot', __FILE__)
require 'rails/all'
config.assets.initialize_on_precompile = false
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Planner
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
答案 0 :(得分:1)
它抱怨第5行的config语句。这需要在Application类定义中,如下所示:
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Planner
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.assets.initialize_on_precompile = false
end
end