机车cms资产从后端丢失

时间:2015-01-18 23:48:05

标签: ruby-on-rails stylesheet nitrousio locomotivecms

我知道在虚拟机上使用这个cms更好,有一些像linux这样的操作系统等等(因为这个命令:$ wagon serve根本不在windows上运行) 我决定使用nitrous io并且它的工作非常好(在ubuntu操作系统上)唯一的问题是当我做我的机车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'

正如locomotivecms文档中所建议的那样,我开始为引擎创建一个新的rails项目:

$ rails new codigos_comentados_engine --skip-active-record --skip-test-unit --skip-javascript --skip-bundle

$ bundle

创建locomotivecms引擎:

$  rails generate locomotive:install

然后,项目中的某些文件在environment / production.rb和environment / development.rb中不起作用:

Error: undefined method `configure' for #<CodigosComentadosEngine::Application:0x007f8
03fe43bf0> (NoMethodError) 

更改此内容时解决:

Rails.Aplication.configure do 

由此:

CodigosComentadosEngine::Application.configure do

然后,机车发动机运转良好,我得到了这个不错的输出:

  1. blah blah
  2. bundle exec unicorn_rails
  3. Open your browser                                 
     open localhost:8080                                            
  4. Follow the installation wizard steps                                     
  5. Enjoy ! 

然后:

$ bundle exec unicorn_rails 

我收到了这个警告但是服务器仍在工作:

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">]>  

行。当我在浏览器中打开这个网址时: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

确定。我在config / initializers / secret_token.rb

中创建了秘密令牌文件
CodigosComentadosEngine::Application.config.secret_token = 'blahblahblahblahblahblahblahblahblahblahblah'

根据亚硝酸盐帮助文档安装mongodb:

 $ parts install mongodb

启动mongodb:

 $ parts start mongodb
 ok. => Started: mongodb

再次启动服务器独角兽:

 $ bundle exec unicorn_rails 

一切都好。  ...

在浏览器中预览: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

在一个论坛中,我发现这一步一步为他们工作,而不是因为我对ubuntu的亚硝酸盐: 链接[https://locomotivecms.tenderapp.com/discussions/problems/309-backend-themestyles-does-not-apply-missing-files-reopen#comment_31593155][1]

建议在链接中“显示”公共/资产目录以运行此命令:

 $ RAILS_ENV=production bundle exec rake assets:precompile

运行此命令后,我得到了这个输出:

 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 

但是puplic / assets没有出现在目录中,并且没有在机车的后端显示任何样式(表单和web正在加载)

之后,我使用--trace运行相同的命令,并得到以下输出:

$ RAILS_ENV=production bundle exec rake --trace assets:precompile

输出:

    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>' 

我google“rake aborted!不知道如何构建任务'默认'”我注意到在Rakefile中我有这一行:

 `Rails.application.load_tasks`

我改变了:

CodigosComentadosEngine::Application.load_tasks

我在GemFile中添加了这一行:gem rake '10 .0.4'

然后我使用成功输出运行此命令:( RAILS_ENV =开发和RAILS_ENV =生产返回成功输出)

 $ RAILS_ENV=development bundle exec rake --trace assets:precompile

输出:

 /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  
....

之后,(根据我发布的论坛链接)的想法是你必须看到公共/资产目录,但我没有看到它。奇怪的是,当我在Windows(7)上安装它时后端样式加载完美,问题出现了$wagon serve command,这是一个已知的胜利问题。

我打算在本地尝试使用ubuntu,而不是亚硝酸盐。如果我成功,我会更新这个问题。你有这个cms和 nitrous 的类似问题吗?

PS。对不起,我的英语可能并不完美。谢谢你的帮助!

0 个答案:

没有答案