加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 避免rake资产的正确方法是什么:Heroku上的预

发布时间:2020-12-17 02:17:49 所属栏目:百科 来源:网络整理
导读:我正在运行Rails 3.2.2并在Cedar堆栈上部署.我仍然收到以下错误: ----- Writing config/database.yml to read from DATABASE_URL----- Preparing app for Rails asset pipeline Running: rake assets:precompile rake aborted! could not connect to server
我正在运行Rails 3.2.2并在Cedar堆栈上部署.我仍然收到以下错误:

-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       could not connect to server: Connection refused
       Is the server running on host "127.0.0.1" and accepting
       TCP/IP connections on port 5432?

即使guide建议将config.assets.initialize_on_precompile设置为false,但提到:

be sure to test rake assets:precompile locally before deploying. It
may expose bugs where your assets reference application objects or
methods,since those are still in scope in development mode regardless
of the value of this flag.

像one这样的一些文章建议使用Heroku labs.但即便如此,也有其自身的含义,因为它仍处于测试阶段.

我在线阅读了其他几个来源,包括:

Rails 3.1 assets:precompile Connecting to Database

rake assets:precompile not working on heroku

所有都有不同的解决方案.那么避免这种错误的正确方法是什么?任何人都遇到Heroku实验室的任何重大问题?有更好的方法吗?

PS.只是为了清楚.正在运行rake资产:预编译RAILS_ENV =开发或rake资产:预编译RAILS_ENV =生产在本地运行它的正确方法?

解决方法

问题源于您的应用程序在运行rake任务时尝试连接到postgres的事实.摆脱错误的唯一方法是阻止这种情况发生,或者使用你提到的user_env_compile附加组件.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读