centos 下搭建ror开源框架spree

编程入门 行业动态 更新时间:2024-10-22 04:23:14

centos  下搭建ror<a href=https://www.elefans.com/category/jswz/34/1770131.html style=开源框架spree"/>

centos 下搭建ror开源框架spree

最近研究了下spree,一个购物网站的开源项目

我的环境是Centos ruby1.9.3 rails3.2, 在这总结一下安装的步骤和一些错误的处理

 

1. 之前安装好了rvm, 与spree安装无关, 所以省略掉

 

2. rvm get head 更新下rvm  

    安装了很久, 最好更新下, 以免ror安装时有问题

 

3. rvm install 1.9.3  

    此处不rvm的就不要看了

 

4. 如果出现It seems your ruby installation is missing psych (for YAML output) 等提示

    需要执行a. rvm pkg install libyaml

                  b. rvm reinstall 1.9.3 --with-libyaml-dir=/usr/local/rvm/usr/

 

5. rvm use 1.9.3

 

6. gem install rails

 

7. 如果出现 Installing ri documentation for rails-3.2.13...

   file 'lib' not found

   Installing RDoc documentation for rails-3.2.13...

   file 'lib' not found

    需要执行 gem install rdoc

 

8. a. ruby -v => ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]

    b. rails -v => Rails 3.2.13

    这是ror安装完成

 

9. gem install bundler

   

10. gem install spree

     遇到 checking for libxml/parser.h... no 

             ----- libxml2 is missing.

     巴拉巴拉一堆的提示......

     需要执行  sudo yum install -y libxml2 libxml2-devel libxslt libxslt-devel

 

11. gem install spree_cmd

 

12. rails new mystore -d mysql 安装mysql版本, -d 可不加, 可换oracle postgresql等

 

13. /etc/init.d/mysqld start 启动mysql

 

14. 修改数据库配置等

 

15. cd mystore 

 

16. spree install

    会有几个提示,让你选择yes/no,无脑yes了,如果明白是什么意思,也可自行选择,但是建议默认吧,苦逼的试着跳过前两个选项, 后面会遇到一些麻烦,还是乖乖的默认了=.=

    a. 遇到Image magick must be installed

       sudo yum install ImageMagick-devel

       sudo yum install ImageMagick

    b. 如果没有安装git 

       sudo yum install git

    c. /execjs/runtimes.rb:51:in `autodetect'

       需要修改Gemfile 放开gem 'therubyracer', :platforms=>:ruby 的注释

       在这句之前加入gem 'execjs'

       之后重新执行spree install

 

以上development环境应该没有问题了, rails s 启动就可以用了

 

===============production==================

 

蛋疼的又去搞production环境

用的是apache passenger, 所以先安装下passenger, apache的安装配置就不多说了

 

18. gem install passenger

     passenger-install-apache2-module

 

19. 在production发布时遇到 

Deface: 1 overrides found for 'spree/layouts/spree_application'

Deface: 'add_analytics_header' matched 1 times with 'head'

  Rendered /usr/local/rvm/gems/ruby-1.9.3-p392/gems/spree_core-1.3.2/app/views/spree/shared/_taxonomies.html.erb (34.1ms)

  Rendered /usr/local/rvm/gems/ruby-1.9.3-p392/gems/spree_core-1.3.2/app/views/spree/shared/_products.html.erb (47.5ms)

  Rendered /usr/local/rvm/gems/ruby-1.9.3-p392/gems/spree_core-1.3.2/app/views/spree/home/index.html.erb within spree/layouts/spree_application (91.5ms)

  Rendered /usr/local/rvm/gems/ruby-1.9.3-p392/gems/spree_core-1.3.2/app/views/spree/shared/_head.html.erb (3.3ms)

Completed 500 Internal Server Error in 219ms

 

ActionView::Template::Error (favicon.ico isn't precompiled):

    3: <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />

    4: <meta content="width=device-width, initial-scale=1.0, maximum-scale=1" name="viewport">

    5: <%== meta_data_tags %>

    6: <%= favicon_link_tag image_path('favicon.ico') %>

    7: <%= stylesheet_link_tag 'store/all', :media => 'screen' %>

    8: <%= csrf_meta_tags %>

    9: <%= javascript_include_tag 'store/all' %>

 

    修改/config/envirments/production.rb  

    config.serve_static_assets = true

    config.assetspile = true

 

 

20. 修改Gemfile, 如果之前默认了spree_gateway和spree_auth_devise, 需要去掉关于git的部分

      gem 'spree_gateway'

      gem 'spree_auth_devise'

      重新bundle install

 

21. 将项目中/public /log /tmp 等三个文件夹给予相应权限

 

22. Spree::Config.set(:allow_ssl_in_production => false) 

      关掉ssl

 

后续还会再完善, 先折腾这些好了.

更多推荐

centos 下搭建ror开源框架spree

本文发布于:2024-02-11 20:22:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1683244.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:开源   框架   centos   ror   spree

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!