【问题标题】:Why does Rails Postgresql not allow me to start my rails app?为什么 Rails Postgresql 不允许我启动我的 rails 应用程序?
【发布时间】:2021-04-26 13:45:56
【问题描述】:

我目前正在尝试通过 Heroku 部署我的 Rails 应用程序。为此,我需要从 sqlite3 切换到 postgresql。我这样做并尝试通过执行“rails s”来测试运行该应用程序。但是,我的浏览器出现以下错误:

could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

也说明这里发生了错误:

    ### Convenience alias for PG::Connection.new.
    def self::connect( *args )
        return PG::Connection.new( *args ) <<< (error in this line)
    end

任何帮助将不胜感激。谢谢!

【问题讨论】:

  • 为什么首先需要上述方法?在 Heroku 上设置 PostgreSQL 通常不需要任何额外的方法和复杂的配置。你跟着什么教程? Heroku 上的官方一篇如何在 Heroku 上添加 PostgreSQL,devcenter.heroku.com/articles/… ?

标签: ruby-on-rails ruby heroku heroku-postgres


【解决方案1】:

根据 Postgres 的安装方式,听起来您需要重新启动 Postgres。

使用 brew

brew services restart postgresql

使用 asdf

pg_ctl stop
pg_ctl start

有时您可能需要重新安装 pg gem。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-10-11
    • 2022-11-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-18
    相关资源
    最近更新 更多