如果在Heroku上使用Publify,如何配置database.yml文件是使用PostgreSQL?

时间:2013-08-22 18:39:05

标签: ruby-on-rails postgresql heroku publify

我正在跟随http://fdv.github.io/publify/#publifydemo的教程,但所有内容都是

  1. 将database.yml.yourEngine重命名为database.yml
  2. 编辑database.yml以添加您的数据库名称,登录名和密码。
  3. 所以我将database.postgresql.yml重命名为database.yml 至于添加登录名和密码,我做了,这是文件

    login: &login
      adapter: postgresql
      host: localhost
      username: troll
    
    development:
      encoding: unicode
      database: typo_dev
      username: troll
      password: lol
      host: localhost:3000
    
    test:
      encoding: unicode
      database: typo_dev
      username: troll
      password: lol
      host: localhost:3000
    
    production:
      database: typo
      username: troll
      password: lol
      host: <hostname or ip address. eg.: localhost>
    

    不确定从哪里开始。我确实搜索了documentation for PostgreSQL但不知道在手册的2808页中从哪里开始。

    我确实碰到了这个问题How to configure Postgresql with rails project?,但它仍未在本地运行

    这是我运行rails server时的日志

    jgallardo:bruxir-typo juan.gallardo$ rails server
    /Users/juan.gallardo/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 3 (Psych::SyntaxError)
    from /Users/juan.gallardo/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
    from /Users/juan.gallardo/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/psych.rb:153:in `parse'
    from /Users/juan.gallardo/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/psych.rb:129:in `load'
    from /Users/juan.gallardo/Desktop/myfiles/test-projects/typo/bruxir-typo/Gemfile:7:in `eval_gemfile'
    from /Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/dsl.rb:30:in `instance_eval'
    from /Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/dsl.rb:30:in `eval_gemfile'
    from /Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/dsl.rb:9:in `evaluate'
    from /Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/definition.rb:19:in `build'
    from /Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler.rb:148:in `definition'
    from /Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler.rb:136:in `load'
    from /Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/bundler-unload-1.0.1/lib/bundler-unload.rb:42:in `with_bundle'
    from /Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rubygems-bundler-1.2.2/lib/rubygems-bundler/noexec.rb:53:in `candidate?'
    from /Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rubygems-bundler-1.2.2/lib/rubygems-bundler/noexec.rb:70:in `setup'
    from /Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rubygems-bundler-1.2.2/lib/rubygems-bundler/noexec.rb:85:in `<top (required)>'
    from /Users/juan.gallardo/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:116:in `require'
    from /Users/juan.gallardo/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:116:in `rescue in require'
    from /Users/juan.gallardo/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:122:in `require'
    from /Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:9:in `<main>'
    

1 个答案:

答案 0 :(得分:1)

不确定这是否是问题,但主机和端口应如下所示:

host: localhost
port: 3000

我认为这不会起作用:

host: localhost:3000