如何将 CKEditor 与 Heroku 集成?

发布于 2024-10-05 00:45:37 字数 360 浏览 8 评论 0原文

这有点棘手,因为 Heroku 在 Dyno Grid 上使用只读文件系统。

这意味着当尝试远程安装 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 元设置的配置文件。我想知道其他人是否也遇到过这些麻烦,他们做了什么来解决这些麻烦?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

緦唸λ蓇 2024-10-12 00:45:38

您是否有理由不将其提交到 git 并将其与源代码的其余部分一起推送到 heroku?我从来没有必要使用heroku 配置CKeditor,但这应该可以工作。

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.

梦醒灬来后我 2024-10-12 00:45:38

出现这个错误的原因是Heroku运行在我的生产环境上。由于 CKEditor 是在新环境中设置的,因此它会尝试写入一堆文件。由于 Heroku 是只读文件系统,因此它会中止此进程。为了绕过此错误:

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

rails s -e production

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

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

现在应该了!

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!

记忆で 2024-10-12 00:45:38

一种便宜的方法是转到 easy_ckeditor/init.rb 并注释掉 check_and_install:

#require 'ckeditor_file_utils'
#CkeditorFileUtils.check_and_install

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
攒眉千度 2024-10-12 00:45:38

对我有用的解决方案如下:

确保

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)

这在另一个堆栈溢出线程中得到了回答:使用 Heroku 在生产 Rails 应用程序上运行 ckeditor 时出现问题

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文