【问题标题】:Rails 3.1 assets:precompile Connecting to DatabaseRails 3.1 assets:precompile 连接到数据库
【发布时间】:2012-02-02 10:28:39
【问题描述】:

在使用资产管道升级到 Rails 3.1 后,我正在尝试将应用程序部署到 Heroku。我在收到错误时遇到了 Heroku 的troubleshooting page 上提到的常见问题:

could not connect to server: Connection refused 
Is the server running on host "127.0.0.1" and accepting 
TCP/IP connections on port xxxx?

我接受了页面上的建议并将以下内容添加到我的 config/application.rb 文件中(在尝试将其添加到单个 [environment].rb 文件后无效)

config.assets.initialize_on_precompile = false

我已经修改了我的 database.yml 文件以将我的生产环境指向一个不存在的数据库,但是在本地运行 assets:precompile 任务时,我得到以下信息:

> RAILS_ENV=production bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
rake aborted!
FATAL:  database "my_nonexistant_database" does not exist

Tasks: TOP => environment
(See full trace by running task with --trace)

我试图弄清楚我的应用程序的哪一部分正在尝试初始化数据库以便我可以修复它,但是我已经没有办法获得比这更多的调试信息了。

谁有任何提示可以获取有关我的应用尝试在哪里初始化数据库的更多信息,或者解决潜在问题?

【问题讨论】:

    标签: ruby-on-rails-3 heroku asset-pipeline


    【解决方案1】:

    您应该尝试新的实验室功能 http://devcenter.heroku.com/articles/labs-user-env-compile,这将使变量在 slug 编译时可用。

    【讨论】:

    • 请注意,这仍然是 非常 测试版,随时可能被取消。小心行事。
    猜你喜欢
    • 2012-02-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-06
    • 1970-01-01
    • 2018-11-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多