[英]Rails production routes issue
在生產中,我在日志中得到以下內容:
我[2013-11-28T10:37:59.495396#1181]信息-:在2013-11-28 10:37:59 +0000 F,[2013年開始為91.104.133.126獲取GET /javascripts/application.js“ -11-28T10:37:59.497931#1181]致命-:ActionController :: RoutingError(沒有與[GET]“ / javascripts / application.js”匹配的路由):
和:
I,[2013-11-28T10:41:05.611348#1181] INFO-:在2013-11-28 10:41:05 +0000 I處為91.104.133.126開始GET“ /” I,[2013-11-28T10: 41:05.615742#1181] INFO-:由PagesController#home作為HTML I處理,[2013-11-28T10:41:05.626276#1181] INFO-:在布局/應用程序中呈現的pages / home.html.erb(7.5 ms)I,[2013-11-28T10:41:05.629343#1181] INFO-:在13ms內完成200 OK(查看:10.5ms | ActiveRecord:0.8ms)I,[2013-11-28T10:41:05.817024# 1181] INFO-:在2013-11-28 10:41:05 +0000 F,[2013-11-28T10:41:05.819748#1181]致命-從91.104.133.126開始GET“ /stylesheets/application.css” -:ActionController :: RoutingError(沒有路由與[GET]“ / stylesheets / application.css”匹配):
在開發過程中沒有發生這種情況。
應用程序與RVM&NginX&Passenger運行,所有最新版本,全新安裝。
更新1:
運行RAILS_ENV=production bundle exec rake assets:precompile
我得到了這些:
ActionController :: RoutingError(沒有路線與[GET]“ / assets / application-0292b59e3ea25ff21b6f72e062924c42.css”匹配):
actionpack(4.0.1)lib / action_dispatch /ActionController :: RoutingError(沒有路由與[GET]“ / javascripts / vendor / modernizr.js”匹配):
ActionController :: RoutingError(沒有與[GET]匹配的路由“ /assets/application-2f1ac76c2ad0b69f7bbab4b9d9dca4b8.js”):
更新2:
rake routes
輸出
Prefix Verb URI Pattern Controller#Action
images_new GET /images/new(.:format) images#new
users_sign_up GET /users/sign_up(.:format) users#sign_up
images_edit GET /images/edit(.:format) images#edit
images_index GET /images/index(.:format) images#index
images_show GET /images/show(.:format) images#show
posts_new GET /posts/new(.:format) posts#new
posts_edit GET /posts/edit(.:format) posts#edit
posts_update GET /posts/update(.:format) posts#update
posts_destroy GET /posts/destroy(.:format) posts#destroy
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create new_user_registration GET
/users/sign_up(.:format) devise/registrations#new edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
pages_home GET /pages/home(.:format) pages#home
posts GET /posts(.:format) posts#index
POST /posts(.:format) posts#create
new_post GET /posts/new(.:format) posts#new
edit_post GET /posts/:id/edit(.:format) posts#edit
post GET /posts/:id(.:format) posts#show
PATCH /posts/:id(.:format) posts#update
PUT /posts/:id(.:format) posts#update
DELETE /posts/:id(.:format) posts#destroy
images GET /images(.:format) images#index
POST /images(.:format) images#create
new_image GET /images/new(.:format) images#new
edit_image GET /images/:id/edit(.:format) images#edit
image GET /images/:id(.:format) images#show
PATCH /images/:id(.:format) images#update
PUT /images/:id(.:format) images#update
DELETE /images/:id(.:format) images#destroy
root GET / pages#home
嘗試在produciton.rb中設置config.assets.compile = true
通過在production.rb中設置config.serve_static_assets = true
解決
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.