我試圖將我的應用程序從Cloud 9移動到Localhost。這是我迄今爲止所做的:Rails 5:在有流浪者的本地主機上啓動應用程序時超時
- 安裝了Vagrant 1.9.1和Virtualbox 5.1.12。在我的Windows 10 64位
- 與流浪安裝了Ubuntu 16.04.1和PostgreSQL 9.5
- 從我的架構
在終端建立DB rails db:setup
我可以啓動Rails的服務器rails server -b 0.0.0.0
和它是否正確啓動:
=> Booting Puma
=> Rails 5.0.1 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.6.2 (ruby 2.3.3-p222), codename: Sleepy Sunday Serenity
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
當我打開http://localhost:3000/
它給了我超時錯誤 Rack::Timeout::RequestTimeoutException in LandingController#index
,並指向我landing/index.html.erb
一行:
<img src="<%= image_path('landing/laptop.png') %>" alt="laptop"/>
在終端我看到這條消息:
Rack::Timeout::RequestTimeoutException (Request ran for longer than 20000ms):
app/views/landing/index.html.erb:51:in `_app_views_landing_index_html_erb___1903502845453706848_40657680'
app/controllers/landing_controller.rb:6:in `index'
Rendering /home/ubuntu/.rvm/gems/ruby-2.3.3/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
Rendering /home/ubuntu/.rvm/gems/ruby-2.3.3/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /home/ubuntu/.rvm/gems/ruby-2.3.3/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (11.6ms)
Rendering /home/ubuntu/.rvm/gems/ruby-2.3.3/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /home/ubuntu/.rvm/gems/ruby-2.3.3/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (4.2ms)
Rendering /home/ubuntu/.rvm/gems/ruby-2.3.3/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /home/ubuntu/.rvm/gems/ruby-2.3.3/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.3ms)
Rendered /home/ubuntu/.rvm/gems/ruby-2.3.3/gems/actionpack-5.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (46.7ms)
source=rack-timeout id=989422929f6047c15c931fac986f4ae0 timeout=20000ms service=22077ms state=completed
資產到位之前在雲9 - 我確實沒有變化任何東西。 我認爲這是與鏈輪的東西,所以我重新安裝,但沒有運氣 - 錯誤保持。
請問我該如何解決這個問題?謝謝!
更新
沒有什麼特別的控制器:
class LandingController < ApplicationController
skip_before_action :logged_in_user, only: [:index]
skip_before_action :get_role, only: [:index]
def index
render layout: 'empty'
end
end
更新2
誤差保持甚至當我將我的應用程序來RailsInstaller適用於Windows,所以我想流氓不是在我的情況下的責任。任何想法我做錯了什麼?在我看來,有一些相關的東西是我從緩存的Cloud 9複製粘貼的應用程序。
您是否嘗試過刷新幾次?我看到的一件事是,Rack :: Timeout可能會在資產第一次編譯時產生錯誤。我們只是在開發模式下禁用它。 – lobati
刷新沒有幫助。我把'config.assets。enabled = false「在config \ environments \ develoment.rb中,但它也沒有幫助。 – matiss
@lobati看來錯誤與Vagrant無關,因爲當我從沒有VM的RailsInstaller啓動我的應用程序時會出現同樣的錯誤。它可能是與緩存相關的東西嗎? – matiss