代码之家  ›  专栏  ›  技术社区  ›  Trip

如何将Keckeditor与Heroku集成?

  •  1
  • Trip  · 技术社区  · 14 年前

    这有点棘手,因为Heroku在其dyno网格上使用只读文件系统。

    这意味着当尝试远程安装ckeditor时,我会得到一个错误:

    heroku rake db:migrate
    rake aborted!
    Read-only file system - /disk1/home/slugs/362142_8858805_b85c-f2f3955d-f087-4bc4-8b1b-b6e898403a10/mnt/public/javascripts/ckcustom.js
    

    ckcustom.js是一个配置文件,用于管理ckeditor的元设置。我想知道是否还有其他人遇到过这些麻烦,他们是怎么绕过这些麻烦的?

    4 回复  |  直到 10 年前
        1
  •  0
  •   Keith Gaddis    14 年前

    你为什么不把它提交给Git,并把它和其他来源一起推到Heroku上呢?我从来没有用Heroku配置过Keckeditor,但这应该在Afaik中有效。

        2
  •  0
  •   Trip    14 年前

    发生此错误的原因是Heroku在我的生产环境中运行。因为Keckeditor是在一个新环境中设置的,所以它尝试写入一组文件。因为heroku是一个只读文件系统,它中止了这个过程。为了绕过此错误:

    在本地计算机上,执行以下操作:

    rails s -e production
    

    查看您的站点,ckeditor将为生产环境编写这些文件。

    git add .
    git commit -m "added files to Production for Heroku"
    git push heroku master
    

    现在应该了!

        3
  •  0
  •   Will Sargent    14 年前

    一个便宜的方法是转到easy-ckeditor/init.rb并注释检查和安装:

    #require 'ckeditor_file_utils'
    #CkeditorFileUtils.check_and_install
    
        4
  •  0
  •   Community CDub    8 年前

    对我有效的解决方案是:

    确保

    bundle update ckeditor
    

    然后,将这些行添加到 config/application.rb

    config.assets.precompile += Ckeditor.assets
    config.assets.precompile += %w( ckeditor/* )
    config.autoload_paths += %W(#{config.root}/app/models/ckeditor)
    

    这在另一个堆栈溢出线程中得到了响应: Problems with ckeditor running on production Rails application with Heroku