2
你如何設置一個config.ru文件來讓Pow在公共目錄之外提供html/css/js文件?假設我想將它們從html文件夾中提取出來。Pow config.ru爲公共目錄之外的靜態文件提供服務?
你如何設置一個config.ru文件來讓Pow在公共目錄之外提供html/css/js文件?假設我想將它們從html文件夾中提取出來。Pow config.ru爲公共目錄之外的靜態文件提供服務?
你可以使用TryStatic
從rack-contrib:
require 'rack/contrib/try_static'
use Rack::TryStatic,
:root => "html",
:urls => %w[/]
您可能要添加if ENV['RACK_ENV'] == 'development'
如果你只在開發過程中需要這個(例如,如果你的Web服務器被配置爲從html/
服務) 。
通過寶石安裝rack-contrib。但不斷收到這個錯誤與config.ru中的這些設置。 NameError:未初始化的常量Rack :: TryStatic – berg 2012-03-16 04:01:03
它似乎'TryStatic'不會自動加載到'rack/contrib.rb'中,請嘗試使用'require'rack/contrib/try_static''。看到我更新的答案。 – matt 2012-03-16 14:21:50
做出更改後,我收到此錯誤。 AssertionError:狀態在ClientResponse._receiveData(/ Users/david/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/client.js:257:27)時必須大於等於100 at [對象對象]。(/ Users/david/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/client.js:47:33) at [object Object] .emit(events.js:64:17 ) 在客戶端。 (Event.js:64:00)下的 (/ Users/david/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/node_modules/netstring/lib/ns.js:206:16) 17) –
berg
2012-03-17 03:19:23