无法配置Database.yml文件。

时间:2016-01-10 18:36:34

标签: ruby-on-rails ruby database heroku

我正在使用Harry的Shave club开源代码设置病毒式登陆页面应用程序。

https://github.com/wardpenney/prelaunchr/tree/master

我努力将应用推向heroku,看起来我的资产没有预编译。我认为这是因为我的database.yml文件设置不正确。有什么想法吗?

这是我尝试编译时的错误。

on RAILS_GROUPS=assets
Connecting to database specified by database.yml
rake aborted!
refer/happycumar.gif isn't precompiled (this is a giff in my assets folder)

这是我尝试推送到heroku时的错误

   Bundle completed (52.44s)
remote:        Cleaning up the bundler cache.
remote: -----> Writing config/database.yml to read from DATABASE_URL
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        Connecting to database specified by DATABASE_URL
remote:        rake aborted!
remote:        could not connect to server: Connection refused
remote:        Is the server running on host "127.0.0.1" and accepting
remote:        TCP/IP connections on port 5432?

remote:        Tasks: TOP => environment
remote:        (See full trace by running task with --trace)
remote:  !
remote:  !     Precompiling assets failed.
remote:  !     Attempted to access a nonexistent database:
remote:  !     https://devcenter.heroku.com/articles/pre-provision-database
remote:  !
remote: 
remote:  !     Push rejected, failed to compile Ruby app
remote: 
remote: Verifying deploy...
remote: 
remote: !   Push rejected to safe-tor-3231.
remote: 

这是我的宝石文件

source 'https://rubygems.org'

gem 'rails', '3.2.11'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'


gem 'activeadmin'
gem 'pg'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

group :development do
  gem 'pry'
end

gem 'rails_12factor' 
gem 'delayed_job_active_record'

gem 'unicorn'


# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger

# gem 'debugger'

我认为我已按照文件中的说明进行操作,但并非100%肯定。再次,由于错误发生的时间,我认为它与Database.yml文件有关。

Database.yml文件。:

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: postgresql
  database: prelaunchr
  host: localhost

# 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:
  adapter: postgresql
  database: prelaunchr
  host: localhost

production:
  adapter: postgresql
  database: prelaunchr
  host: localhost

它说测试数据库不应该与生产和开发dbs相同,但我只是不确定我将其更改为什么,如何正确配置,或者是否&#甚至连问题......

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

有趣的是当你打破一个问题时会发生什么......

Error pushing to heroku - aborting my rake assets:precompile

找到答案