내가 뭘 잘못하고 있는지 확실하지 않고 내 database.yml에서 프로덕션 섹션을 제외하려고 시도했지만 작동하지 않았습니다.
development:
...
test:
...
production:
database: myapp_production
pool: 5
내 gemfile :
gem 'pg', :group => :production
gem 'mysql2', '>= 0.3.18', '< 0.5', :group => [:development, :test]
실행할 때이 오류가 발생합니다.
Running rake db:setup on ⬢ still-crag-69600... up, run.8579 (Free)
rake aborted!
ActiveRecord::AdapterNotSpecified: 'production' database is not configured. Available: ["development", "test"]
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:246:in `resolve_symbol_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:227:in `resolve_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:141:in `resolve'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:55:in `establish_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:139:in `create_current'
프로덕션에서 다음을 추가해야합니다.
adapter: postgresql
url: <%= ENV['DATABASE_URL'] %>
postgresql 애드온 을 생성했는지 확인하십시오 . DATABASE_URL
heroku postgresql 애드온을 추가하면 환경 변수가 자동으로 설정됩니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다