我将 Nesta (0.9.8) cms 添加到现有的 Rails 3.0.10 应用程序中。我启动并运行了博客,但没有启动布局/样式表。
到目前为止我所做的是:
1.在rails应用程序主根目录中,添加gem'nesta',gem'sass'并运行
'捆'
2.运行“nesta新nesta-博客”
3.编辑config.ru如下:
require ::File.expand_path('../config/environment', __FILE__)
map "/" do
run MyRails3App::Application
end
require 'nesta/env'
require 'nesta/app'
Nesta::App.root = ::File.expand_path('./nesta-blog', ::File.dirname(__FILE__))
map "/blog" do
run Nesta::App
end
4. 编辑 config/routes.rb 如下:
require 'nesta/env'
require 'nesta/app'
Rails3MongoidOmniauthSimple::Application.routes.draw do
mount Nesta::App.new => "/blog"
root :to => "home#index"
...
5. cd 内斯塔博客
6. 运行nesta demo:content
现在,如果你跑rails s
从你的 ~/main-rails-app ,去http://localhost:3000/博客 http://localhost:3000/blog您将看到演示nesta站点,但没有他的默认布局/样式表,而如果您运行shotgun config.ru
从 ~/main-rails-app/nesta-blog 内部,前往http://本地主机:9393/ http://localhost:9393/一切都显示正确。
有什么建议吗?
提前致谢
卢卡·G·索阿夫
我还没有达到我想要的即插即用的水平,但我通过将其添加到 config/routes.rb 来在我的 Rails 3.0 站点上运行 Nesta:
mount Nesta::App, :at => '/'
match '/css/*style.css' => Nesta::App
match '/attachments/*file' => Nesta::App
我还没有研究一种更干净的方法来执行此操作(即避免指定 css 和附件路由)。
我在位于“#{Rails.root}/nesta”的目录中创建了 Nesta 应用程序。我还需要一个 in config/initializers/nesta.rb:
require "nesta/env"
Nesta::Env.root = ::File.expand_path("../../nesta",
File.dirname(__FILE__))
我也很喜欢你的做法。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)