Rails应用程序仅在heroku上无法在本地运行

时间:2016-07-20 21:18:19

标签: ruby-on-rails heroku localhost

我对Rails比较陌生。我做了一个应用程序(本地),现在经过很多麻烦后我终于设法用一个sql数据库在Heroku上部署它。我现在的问题是我不能再在本地运行它,我不知道如何解决这个问题。

我将不胜感激任何提示或建议!

这是我的终端日志,但我不明白。

mdole-MacBook-Pro:myapp mdole$ rails server
=> Booting Thin
=> Rails 4.2.4 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/Users/mdole/Documents/myapp/config/environments/development.rb:3:in `[]=': no implicit conversion of Array into String (TypeError)
    from /Users/mdole/Documents/myapp/config/environments/development.rb:3:in `block in <top (required)>'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/railtie.rb:210:in `instance_eval'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/railtie.rb:210:in `configure'
    from /Users/mdole/Documents/myapp/config/environments/development.rb:1:in `<top (required)>'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:598:in `block (2 levels) in <class:Engine>'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:597:in `each'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:597:in `block in <class:Engine>'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:420:in `block (2 levels) in each_strongly_connected_component_from'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:419:in `block in each_strongly_connected_component_from'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:44:in `each'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:44:in `tsort_each_child'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:413:in `call'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:413:in `each_strongly_connected_component_from'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `call'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
    from /Users/mdole/Documents/myapp/config/environment.rb:5:in `<top (required)>'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /Users/mdole/Documents/myapp/config.ru:3:in `block in <main>'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
    from /Users/mdole/Documents/myapp/config.ru:in `new'
    from /Users/mdole/Documents/myapp/config.ru:in `<main>'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/server.rb:61:in `app'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/server.rb:139:in `log_to_stdout'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/server.rb:78:in `start'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:80:in `block in server'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
    from /Users/mdole/Documents/myapp/bin/rails:9:in `require'
    from /Users/mdole/Documents/myapp/bin/rails:9:in `<top (required)>'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-1.6.4/lib/spring/client/rails.rb:28:in `load'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-1.6.4/lib/spring/client/rails.rb:28:in `call'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-1.6.4/lib/spring/client/command.rb:7:in `call'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-1.6.4/lib/spring/client.rb:28:in `run'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-1.6.4/bin/spring:49:in `<top (required)>'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-1.6.4/lib/spring/binstub.rb:11:in `load'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-1.6.4/lib/spring/binstub.rb:11:in `<top (required)>'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/mdole/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/mdole/Documents/myapp/bin/spring:13:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

Development.rb (更改了数据库网址并传递)

Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.
    ENV["REDISTOGO_URL"] = 'redis://admin:password\!@url.to.database:3306',


  # In the development environment your application's code is reloaded on
  # every request. This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Do not eager load code on boot.
  config.eager_load = false

  # Show full error reports and disable caching.
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  # Don't care if the mailer can't send.
  config.action_mailer.raise_delivery_errors = false

  # Print deprecation notices to the Rails logger.
  config.active_support.deprecation = :log

  # Raise an error on page load if there are pending migrations.
  config.active_record.migration_error = :page_load

  # Debug mode disables concatenation and preprocessing of assets.
  # This option may cause significant delays in view rendering with a large
  # number of complex assets.
  config.assets.debug = true

  # Asset digests allow you to set far-future HTTP expiration dates on all assets,
  # yet still be able to expire them through the digest params.
  config.assets.digest = true

  # Adds additional error checking when serving assets at runtime.
  # Checks for improperly declared sprockets dependencies.
  # Raises helpful error messages.
  config.assets.raise_runtime_errors = true

  # Raises error for missing translations
  # config.action_view.raise_on_missing_translations = true
end

1 个答案:

答案 0 :(得分:1)

看起来第三行末尾的逗号将其丢弃。