Ruby on rails 生产中的数据库创建问题

Ruby on rails 生产中的数据库创建问题,ruby-on-rails,nginx,puma,Ruby On Rails,Nginx,Puma,我需要用nginx和puma创建rails应用程序。我遵循以下指南: 但这一行并没有像预期的那样起作用: RAILS_ENV=production rake db:create 它会删除以下错误: ** Invoke db:create (first_time) ** Invoke db:load_config (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:load_co

我需要用nginx和puma创建rails应用程序。我遵循以下指南:

但这一行并没有像预期的那样起作用:

RAILS_ENV=production rake db:create
它会删除以下错误:

** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:create
no implicit conversion of nil into String
Couldn't create '' database. Please check your configuration.
rake aborted!
TypeError: no implicit conversion of nil into String
[...]
Tasks: TOP => db:create
以下是my database.yml文件的内容:

# SQLite. Versions 3.8.0 and up are supported.
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
  adapter: sqlite3
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

# 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: db/test.sqlite3
    
    production:
     <<: *default
     host: localhost
     adapter: postgresql
     encoding: utf8
     database:
     pool: 5
     username: user
     password: mdp
#SQLite。支持3.8.0及以上版本。
#gem安装sqlite3
#
#确保在gem文件中定义了SQLite 3 gem
#gem'sqlite3'
#
默认值:&默认值
适配器:sqlite3
游泳池:
超时:5000
发展:

你能检查config/database.yml文件
production
database
name吗

一定是这边

production:
  <<: *default
  database: app_production
生产:

所有环境都必须使用相同的数据库适配器

PostgreSQL的示例database.yml文件。你能检查一下这个的配置吗

# PostgreSQL. Versions 9.1 and up are supported.
#
# Install the pg driver:
#   gem install pg
# On OS X with Homebrew:
#   gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On OS X with MacPorts:
#   gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
#   gem install pg
#       Choose the win32 build.
#       Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile
# gem 'pg'
#
default: &default
  adapter: postgresql
  encoding: unicode
  host: localhost
  pool: <%= ENV.fetch("DB_POOL_SIZE") { 15 } %>

development:
  <<: *default
  database: myapp_development


test:
  <<: *default
  database: myapp_test

# As with config/secrets.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
# ever seen by anyone, they now have access to your database.
#
# Instead, provide the password as a unix environment variable when you boot
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
# for a full rundown on how to provide these environment variables in a
# production deployment.
#
# On Heroku and other platform providers, you may have a full connection URL
# available as an environment variable. For example:
#
#   DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
#
# You can use this database configuration with:
#
#   production:
#     url: <%= ENV['DATABASE_URL'] %>
#
production:
  <<: *default
  username: user
  password: mdp
  database: myapp_production
#PostgreSQL。支持9.1及以上版本。
#
#安装pg驱动程序:
#gem安装页面
#在使用自制软件的OS X上:
#gem安装pg----使用pg config=/usr/local/bin/pg_config
#在带有MacPorts的OS X上:
#gem安装pg--with pg config=/opt/local/lib/postgresql84/bin/pg_-config
#在Windows上:
#gem安装页面
#选择win32版本。
#安装PostgreSQL并将其/bin目录放在您的路径上。
#
#使用Gemfile配置
#宝石“pg”
#
默认值:&默认值
适配器:postgresql
编码:unicode
主机:本地主机
游泳池:
发展:

那是你的database.yml文件,还是问题中的缩进有问题?是的,是我的database.ymlWell,那么缩进都错了,你必须修复它。