heroku错误无法创建'limoexotic_production'数据库。请检查您的配置

问题描述 投票:0回答:1

我在heroku应用程序中托管了一个简单的网站,我在这里找到了很多解决方案,但没有任何解决方案可以解决我的问题!它在本地运行良好,但是在heroku中,当我运行heroku运行rake db:migrate时出现此错误

heroku run rake db:create db:migrate
Running rake db:create db:migrate on ⬢ limoexotic... up, run.9833 (Free)
could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Couldn't create 'limoexotic_production' database. Please check your configuration.
rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
/app/vendor/bundle/ruby/2.4.0/gems/pg-0.18.4/lib/pg.rb:45:in `initialize'
/app/vendor/bundle/ruby/2.4.0/gems/pg-0.18.4/lib/pg.rb:45:in `new'
/app/vendor/bundle/ruby/2.4.0/gems/pg-0.18.4/lib/pg.rb:45:in `connect'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:692:in `connect'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:223:in `initialize'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `new'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `postgresql_connection'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:830:in `new_connection'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:874:in `checkout_new_connection'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:853:in `try_to_checkout_new_connection'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:814:in `acquire_connection'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:538:in `checkout'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:382:in `connection'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:1033:in `retrieve_connection'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/connection_handling.rb:118:in `retrieve_connection'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/connection_handling.rb:90:in `connection'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/tasks/postgresql_database_tasks.rb:12:in `connection'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/tasks/postgresql_database_tasks.rb:21:in `create'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/tasks/database_tasks.rb:119:in `create'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/tasks/database_tasks.rb:139:in `block in create_current'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/tasks/database_tasks.rb:316:in `block in each_current_configuration'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/tasks/database_tasks.rb:313:in `each'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/tasks/database_tasks.rb:313:in `each_current_configuration'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/tasks/database_tasks.rb:138:in `create_current'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.4.2/lib/active_record/railties/databases.rake:29:in `block (2 levels) in <main>'
/app/vendor/bundle/ruby/2.4.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:74:in `load'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:28:in `run'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-2.0.2/lib/bundler/cli.rb:465:in `exec'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-2.0.2/lib/bundler/cli.rb:27:in `dispatch'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-2.0.2/lib/bundler/cli.rb:18:in `start'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-2.0.2/exe/bundle:30:in `block in <top (required)>'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-2.0.2/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/app/vendor/bundle/ruby/2.4.0/gems/bundler-2.0.2/exe/bundle:22:in `<top (required)>'
/app/bin/bundle:3:in `load'
/app/bin/bundle:3:in `<main>'
Tasks: TOP => db:create
(See full trace by running task with --trace)

在我的database.yml文件中

        default: &default
          adapter: postgresql
          pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
          timeout: 5000

    development:
      <<: *default
      database: limoexotic_development

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: limoexotic_test

production:
  <<: *default
  database: limoexotic_production
database postgresql heroku migrate pg
1个回答
0
投票

之所以无法更新DATABASE_URL,是因为它当前指向另一个没有任何辅助附件的数据库。我通过转到heroku.com url到我的应用程序,然后设置Config Vars解决了错误。DATABASE_URL与ORIGINAL_DB_URL不同,因此我将DATABASE_URL更改为类似于ORIGINAL_DB_URL。 ........

© www.soinside.com 2019 - 2024. All rights reserved.