mel*_*att 9 ruby-on-rails stylesheet locomotivecms nitrousio
我知道在虚拟机上使用这个cms更好,有一些像linux这样的操作系统等等(因为这个命令:$ wagon serve根本不在windows上运行)我决定使用nitrous io并且它的工作非常好(在ubuntu上) os)唯一的问题是,当我做我的机车cms安装的预览时,它显示没有样式(css)的后端.
Rails 3.2.19 ruby 2.1.0
这里一步一步的命令我跑了,这对我不起作用:首先,我的gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '3.2.19'
gem 'locomotive_cms', '~> 2.4.1', :require => 'locomotive/engine'
group :assets do
gem 'compass', '~> 0.12.7'
gem 'compass-rails', '~> 1.0.2'
gem 'sass-rails', '~> 3.2.6'
gem 'coffee-rails', '~> 3.2.2'
gem 'uglifier', '~> 2.5.1'
gem 'therubyracer', :platforms => :ruby
end
# Use unicorn as the app server
gem 'unicorn'
gem 'rake', '10.0.4'
Run Code Online (Sandbox Code Playgroud)
正如locomotivecms文档中所建议的那样,我开始为引擎创建一个新的rails项目:
$ rails new codigos_comentados_engine --skip-active-record --skip-test-unit --skip-javascript --skip-bundle
$ bundle
Run Code Online (Sandbox Code Playgroud)
创建locomotivecms引擎:
$ rails generate locomotive:install
Run Code Online (Sandbox Code Playgroud)
然后,项目中的某些文件在environment/production.rb和environment/development.rb中不起作用:
Error: undefined method `configure' for #<CodigosComentadosEngine::Application:0x007f8
03fe43bf0> (NoMethodError)
Run Code Online (Sandbox Code Playgroud)
更改此内容时解决:
Rails.Aplication.configure do
Run Code Online (Sandbox Code Playgroud)
这样:
CodigosComentadosEngine::Application.configure do
Run Code Online (Sandbox Code Playgroud)
然后,机车引擎运作良好,我得到了这个不错的输出:
1. blah blah
2. bundle exec unicorn_rails
3. Open your browser
open localhost:8080
4. Follow the installation wizard steps
5. Enjoy !
Run Code Online (Sandbox Code Playgroud)
然后:
$ bundle exec unicorn_rails
Run Code Online (Sandbox Code Playgroud)
我得到了这个警告但是服务器仍在工作:
WARNING: unable to load the content types, Could not connect to any secondary or primary nodes for replica set <Moped::Cluster nodes=[<Moped::Node resolved_address="127.0.0.1:270
17">]>
Run Code Online (Sandbox Code Playgroud)
好.当我在浏览器中打开此URL时:myprojectblahblahblah.nitrousbox.com:8080
我收到了下一条消息:
ArgumentError: A secret is required to generate an integrity hash for cookie session data. Use config.secret_token = "some secret phrase of at least 30 characters"in config/initializers/secret_token.rb
Run Code Online (Sandbox Code Playgroud)
好.我在config/initializers/secret_token.rb中创建了秘密令牌文件
CodigosComentadosEngine::Application.config.secret_token = 'blahblahblahblahblahblahblahblahblahblahblah'
Run Code Online (Sandbox Code Playgroud)
根据亚硝酸盐帮助文档安装mongodb:
$ parts install mongodb
Run Code Online (Sandbox Code Playgroud)
启动mongodb:
$ parts start mongodb
ok. => Started: mongodb
Run Code Online (Sandbox Code Playgroud)
再次启动服务器独角兽:
$ bundle exec unicorn_rails
Run Code Online (Sandbox Code Playgroud)
一切都没事. ...
在浏览器中预览:myprojectblahblahblah.nitrousbox.com:8080
但是后端的样式没有出现,加载外观,没有样式我甚至可以创建用户并看到我的网站.
当我检查html <script></script>时,头部的路径是:
myprojectblahblah.nitrousbox.com:8080/javascripts/locomotive/not_logged_in.js
myprojectblahblah.nitrousbox.com:8080/stylesheets/locomotive/not_logged_in.css
Run Code Online (Sandbox Code Playgroud)
在一个论坛中,我发现这一步一步一步为他们工作,而不是我用ubuntu的亚硝酸盐:链接[ https://locomotivecms.tenderapp.com/discussions/problems/309-backend-themestyles-does-not-apply-失踪的文件,重新打开#comment_31593155] [1]
为了使链接中的"public/assets"目录"显示",建议运行此命令:
$ RAILS_ENV=production bundle exec rake assets:precompile
Run Code Online (Sandbox Code Playgroud)
运行此命令后,我得到了这个输出:
Digest::Digest is deprecated; use Digest
/home/action/.parts/packages/ruby2.1/2.1.1/bin/ruby /home/action/.gem/ruby/2.1.1/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
Digest::Digest is deprecated; use Digest
Run Code Online (Sandbox Code Playgroud)
但是puplic/assets没有出现在目录中,并且没有在机车的后端显示任何样式(表单和web正在加载)
之后,我运行相同的命令,但使用--trace,我得到以下输出:
$ RAILS_ENV=production bundle exec rake --trace assets:precompile
Run Code Online (Sandbox Code Playgroud)
OUTPUT:
rake aborted!
Don't know how to build task 'default'
/home/action/.gem/ruby/2.1.1/gems/rake-10.0.4/lib/rake/application.rb:142:in `invoke_task'
...
/home/action/.gem/ruby/2.1.1/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
/home/action/.gem/ruby/2.1.1/bin/rake:23:in `load'
/home/action/.gem/ruby/2.1.1/bin/rake:23:in `<main>'
Run Code Online (Sandbox Code Playgroud)
我google"rake aborted!不知道如何构建任务'默认'"我注意到在Rakefile中我有这行:
`Rails.application.load_tasks`
Run Code Online (Sandbox Code Playgroud)
我改变了:
CodigosComentadosEngine::Application.load_tasks
Run Code Online (Sandbox Code Playgroud)
我在GemFile中添加了这一行:gem rake '10 .0.4'
然后我用一个成功的输出运行了这个命令:( RAILS_ENV = development和RAILS_ENV = production返回一个成功的输出)
$ RAILS_ENV=development bundle exec rake --trace assets:precompile
Run Code Online (Sandbox Code Playgroud)
输出:
/home/action/.parts/packages/ruby2.1/2.1.1/bin/ruby /home/action/.gem/ruby/2.1.1/bin/rake assets:precompile:all RAILS_ENV=development RAILS_GROUPS=assets --trace
Digest::Digest is deprecated; use Digest
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
**.....
** Execute assets:precompile:primary
....
Run Code Online (Sandbox Code Playgroud)
之后,(根据我发布的论坛链接)的想法是你必须看到公共/资产目录,但我没有看到它.奇怪的是,当我在Windows(7)上安装它后端样式加载完美,问题出现了$wagon serve command,这是一个已知的胜利问题.
我打算在本地尝试ubuntu,没有亚硝酸盐.如果我成功,我会更新这个问题.你对这个cms和nitrous有类似的问题吗?
PS.对不起,我的英语可能并不完美.谢谢你的帮助!
| 归档时间: |
|
| 查看次数: |
433 次 |
| 最近记录: |