【发布时间】:2021-01-19 14:50:18
【问题描述】:
我需要使用 nginx 和 puma 创建 rails 应用程序。我遵循了这个指南:https://www.codeflow.site/fr/article/how-to-deploy-a-rails-app-with-puma-and-nginx-on-ubuntu-14-04。
但是这条线没有按预期工作:
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
这是我的 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
【问题讨论】:
-
是您的 database.yml 文件,还是问题中的缩进关闭?
-
是的,这是我的 database.yml
-
好吧,那缩进全错了,你必须修复它。
标签: ruby-on-rails nginx puma