【问题标题】:Trouble configuring Database.yml file.配置 Database.yml 文件时遇到问题。
【发布时间】:2016-04-15 00:56:22
【问题描述】:

我正在使用 Harry's Shave 俱乐部的开源代码设置一个病毒式登录页面 rails 应用程序。

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: 

这是我的 gemfile

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

它说测试数据库不应该与生产和开发数据库相同,但我只是不确定我会将它更改为什么,如何正确配置它,或者这是否是问题所在。 ..

感谢您的帮助。

【问题讨论】:

    标签: ruby-on-rails ruby database heroku


    【解决方案1】:

    有趣的是,当你分解一个问题时会发生什么......

    在这里找到答案Error pushing to heroku - aborting my rake assets:precompile

    【讨论】:

      猜你喜欢
      • 2016-04-14
      • 2011-07-15
      • 2020-04-09
      • 2014-04-21
      • 1970-01-01
      • 1970-01-01
      • 2012-03-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多