How to integrate CKEditor with Heroku?

别等时光非礼了梦想. 提交于 2019-12-20 05:36:12

问题


This is a bit tricky because Heroku uses a Read-only Filesystem across their Dyno Grid.

Which means when trying to install ckeditor remotely, I get an error :

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 is a config file to manage your meta settings for ckeditor. I was wondering if anyone else had these troubles, and what they did to get around them?


回答1:


Is there a reason why you're not just committing it to git and pushing it to heroku along with the rest of your source? I've never had to configure CKeditor with heroku, but that ought to work AFAIK.




回答2:


The reason this error occured was because Heroku ran on my production environment. Because CKEditor is being set up on a new environment, it attempts to write a bunch of files. Because Heroku is a read-only file system it aborts this process. In order to bypass this error :

On your local machine, perform this :

rails s -e production

View your site, CKeditor will write those files for production env.

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

It should now!




回答3:


A cheap way to do it is to go to easy_ckeditor/init.rb and comment out the check_and_install:

#require 'ckeditor_file_utils'
#CkeditorFileUtils.check_and_install



回答4:


The solution that worked for me was the following:

Make sure to

bundle update ckeditor

and then, add these lines to config/application.rb

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

This was answered in this other stack overflow thread: Problems with ckeditor running on production Rails application with Heroku



来源:https://stackoverflow.com/questions/4306951/how-to-integrate-ckeditor-with-heroku

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!