Ruby on rails 推送到heroku后无法访问应用程序
在gemfile和config/application.rb文件中进行了一些操作之后,我将我的应用程序推送到了heroku 我在Bundler.require上方的application.rb文件中有Ruby on rails 推送到heroku后无法访问应用程序,ruby-on-rails,ruby,heroku,gemfile,Ruby On Rails,Ruby,Heroku,Gemfile,在gemfile和config/application.rb文件中进行了一些操作之后,我将我的应用程序推送到了heroku 我在Bundler.require上方的application.rb文件中有config.assets.initialize\on\u precompile=false 这是档案 source 'https://rubygems.org' ruby '2.1.0' gem 'rails', '4.0.5' group :development, :test do
config.assets.initialize\on\u precompile=false
这是档案
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
需要文件。展开路径('../boot',文件)
需要“rails/all”
config.assets.initialize\u on\u precompile=false
#需要Gemfile中列出的宝石,包括任何宝石
#您仅限于:测试、开发或:生产。
Bundler.require(*Rails.groups)
模块规划器
类应用程序
它正在抱怨第5行的config语句。这需要在应用程序类定义中,如下所示:
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
需要文件。展开路径('../boot',文件)
需要“rails/all”
#需要Gemfile中列出的宝石,包括任何宝石
#您仅限于:测试、开发或:生产。
Bundler.require(*Rails.groups)
模块规划器
类应用程序
您检查日志了吗?(heroku日志
)是。我看到:Slug编译失败:未能编译Ruby应用程序,以及:/app/config/application.rb:5:in':main:Object(NameError)的未定义局部变量或方法
config')。您能发布您的application.rb文件吗?谢谢。你能解释一下这一行的必要性吗?有时候我推的应用程序需要它,但我真的不明白为什么在某些情况下需要它,而在其他情况下不需要它。奇怪的是,这个应用程序是因为这个错误而成功推出的。我真的不确定。一些快速研究表明,它曾经是Rails 3中的一个常见设置,但后来被弃用并从文档中删除。我在这里找到了一个参考: