localhost:3000 500内部服务器错误

时间:2015-06-18 21:19:19

标签: ruby-on-rails postgresql localhost

我觉得我搞砸了很多东西。我已经使用了这个命令NSNotificationCenter .defaultCenter() .removeObserver(self) 很长一段时间了,我是一个快乐的男孩。但是今天我忘了生成一个使用rails new app --database=postgresql的应用。现在,每次我运行postgresql并转到rails new app --database=postgresql,我都会受到

的欢迎
  

500内部服务器错误如果您是此管理员   网站,然后请阅读此Web应用程序的日志文件和/或   网络服务器的日志文件,以找出问题所在。

我检查了日志,我有类似的东西:

http://localhost:3000/

然后我启动Started GET "/" for ::1 at 2015-06-18 23:11:56 +0200 ActiveRecord::NoDatabaseError (FATAL: database "toy_development" does not exist ): activerecord (4.2.1) lib/active_record/connection_adapters/postgresql_adapter.rb:661:in `rescue in connect' activerecord (4.2.1) lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect' activerecord (4.2.1) lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize' activerecord (4.2.1) lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new' activerecord (4.2.1) lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection' activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection' activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection' activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection' activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout' /Users/siaw/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize' activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout' activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection' /Users/siaw/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize' activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection' activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:567:in `retrieve_connection' activerecord (4.2.1) lib/active_record/connection_handling.rb:113:in `retrieve_connection' activerecord (4.2.1) lib/active_record/connection_handling.rb:87:in `connection' activerecord (4.2.1) lib/active_record/migration.rb:384:in `connection' activerecord (4.2.1) lib/active_record/migration.rb:371:in `call' actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `call' activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `_run_callbacks' activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_call_callbacks' activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks' actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call' actionpack (4.2.1) lib/action_dispatch/middleware/reloader.rb:73:in `call' actionpack (4.2.1) lib/action_dispatch/middleware/remote_ip.rb:78:in `call' actionpack (4.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' web-console (2.1.3) lib/web_console/middleware.rb:37:in `call' actionpack (4.2.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' railties (4.2.1) lib/rails/rack/logger.rb:38:in `call_app' railties (4.2.1) lib/rails/rack/logger.rb:20:in `block in call' activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `block in tagged' activesupport (4.2.1) lib/active_support/tagged_logging.rb:26:in `tagged' activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `tagged' railties (4.2.1) lib/rails/rack/logger.rb:20:in `call' actionpack (4.2.1) lib/action_dispatch/middleware/request_id.rb:21:in `call' rack (1.6.3) lib/rack/methodoverride.rb:22:in `call' rack (1.6.3) lib/rack/runtime.rb:18:in `call' activesupport (4.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' rack (1.6.3) lib/rack/lock.rb:17:in `call' actionpack (4.2.1) lib/action_dispatch/middleware/static.rb:113:in `call' rack (1.6.3) lib/rack/sendfile.rb:113:in `call' railties (4.2.1) lib/rails/engine.rb:518:in `call' railties (4.2.1) lib/rails/application.rb:164:in `call' rack (1.6.3) lib/rack/lock.rb:17:in `call' rack (1.6.3) lib/rack/content_length.rb:15:in `call' rack (1.6.3) lib/rack/handler/webrick.rb:88:in `service' /Users/siaw/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service' /Users/siaw/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run' /Users/siaw/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread' Rendered /Users/siaw/.rvm/gems/ruby-2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (15.2ms) 来创建一个名为psql的数据库。 toy_development是我的应用btw的名称。创建该数据库后。我再次尝试在浏览器中加载toy。然后现在我明白了:

localhost

我需要一些帮助。 :)

2 个答案:

答案 0 :(得分:1)

我发现Bundler将我的rack版本更新为rack (1.6.3),因此我将其手动更改为rack (1.6.2)中的Gemfile.lock。这应该保持现在的工作,直到Rails团队修复它。

答案 1 :(得分:0)

如前所述,您使用postgresql作为数据库rails默认情况下不创建数据库。 如果您将sqlite3用作数据库

,则不会出现这种情况
bundle exec rake db:create

然后,

bundle exec rake db:migrate