ruby-on-rails – Rails 4 Heroku postgreSQL错误
发布时间:2020-12-17 02:40:08 所属栏目:百科 来源:网络整理
导读:我在使用SQLite3将现有应用程序更改为postgreSQL时遇到了问题.我正在按照本教程将SQLite3转换为postgreSQL并将其部署到heroku: https://devcenter.heroku.com/articles/sqlite3#running-rails-on-postgres. 我删除了gem’sqlite3’并替换为gem’pg’. 修改c
我在使用SQLite3将现有应用程序更改为postgreSQL时遇到了问题.我正在按照本教程将SQLite3转换为postgreSQL并将其部署到heroku:
https://devcenter.heroku.com/articles/sqlite3#running-rails-on-postgres.
我删除了gem’sqlite3’并替换为gem’pg’. $rake db:create和$rake db:migrate导致此错误: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"? 生产中使用的Gemfile: gem 'rails_12factor' gem 'thin' gem 'pg' 以下是我使用本地服务器运行时出现的错误: /usr/local/rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `initialize': could not connect to server: No such file or directory (PG::ConnectionBad) Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"? 解决方法
您好像没有在Heroku帐户中添加Heroku Postgres数据库.配置数据库后,您的应用程序将连接到该数据库.如果没有配置数据库,它将回退到本地查找数据库.
如果您确实配置了数据库,则Heroku环境会出现问题,导致无法找到数据库连接设置. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |