這是我第一次在生產環境中啓動rails應用程序。我第一次運行rails server -e production
,然後必須得到密鑰。之後我跑了這條線bundle exec rake assets:precompile db:migrate RAILS_ENV=production
。有一次,我跑這條線我跑rails server -e production
一次我在終端得到了以下錯誤(見最後4行),在瀏覽器中的404錯誤頁面沿:無法在本地生產環境中啓動rails - Rails 5
[email protected]:~/Desktop/cnd$ rails server -e production
=> Booting Puma
=> Rails 5.1.3 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.10.0 (ruby 2.3.3-p222), codename: Russell's Teapot
* Min threads: 5, max threads: 5
* Environment: production
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
/home/krav/Desktop/cnd/app/views/creatives/index.html.erb:20: warning: key :data is duplicated and overwritten on line 20
/home/krav/Desktop/cnd/app/views/creatives/index.html.erb:20: warning: key :data is duplicated and overwritten on line 20
/home/krav/Desktop/cnd/app/views/creatives/index.html.erb:107: warning: key :data is duplicated and overwritten on line 107
/home/krav/Desktop/cnd/app/views/creatives/index.html.erb:107: warning: key :data is duplicated and overwritten on line 107
當我去是行這裏給了一個錯誤,他們分別是:
線20
<%= image_tag "AdobeStock_95578405.jpeg" ,alt: "slidebg1", :data => {bgposition: "center bottom"} , :data => {bgrepeat: "no-repeat"} ,:data => {bgfit: "cover"} , :class => "rev-slidebg" %>
線107
<%= image_tag "AdobeStock_108067927.jpeg" ,alt: "slidebg1", :data => {bgposition: "center bottom"} , :data => {bgrepeat: "no-repeat"} ,:data => {bgfit: "cover"} , :class => "rev-slidebg" %>
在開發中,這工作正常。我無法弄清楚爲什麼這些行給我一個錯誤,並且不允許Web應用程序啓動,他們看起來是正確的,並讓我看到我在開發模式時需要的外觀。