简体   繁体   中英

database “db/development.sqlite3” does not exist - how to fix?

a friend deployed my application on Heroku, and it works fine there. But I can not open my application on local server. Can anyone help?

When going on localhost i get the following error message:

ActiveRecord::NoDatabaseError FATAL: database "db/development.sqlite3" does not exist

Extracted source (around line #661):

    rescue ::PG::Error => error
      if error.message.include?("does not exist")
        raise ActiveRecord::NoDatabaseError.new(error.message, error)
      else
        raise
      end

Update your database.yml

default: &default
  adapter: postgresql
  encoding: utf8

development:
  <<: *default
  database: your_app_development
  username: your_usernmae
  password: your_password

I solved this by changing database.yml file to actually be the names of the database you want to create like database: my_app_development ex:

development:
  <<: *default
  database: ***_development

You need to change database: and run rails db:create then rails db:migrate RAILS_ENV=development

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM