use*_*724 21 ruby git ruby-on-rails heroku
我需要帮助.当我尝试将我的应用程序上传到heroku时,我收到此错误,有人知道为什么吗?有些是错的.谢谢
Using rake (10.1.0)
...
Using tlsmail (0.0.1)
Using uglifier (2.1.2)
Your bundle is complete! It was installed into ./vendor/bundle
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
/tmp/build_e8889be5-168c-49ed-81e7-b71061fc82ee/vendor/bundle/ruby/1.9.1/gems/tlsmail-0.0.1/lib/net/smtp.rb:806: warning: already initialized constant SMTPSession
...
/tmp/build_e8889be5-168c-49ed-81e7-b71061fc82ee/vendor/bundle/ruby/1.9.1/gems/tlsmail-0.0.1/lib/net/pop.rb:702: warning: already initialized constant APOPSession
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_e8889be5-168c-49ed-81e7-b71061fc82ee/Rakefile:7)
...
rake aborted!
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
/tmp/build_e8889be5-168c-49ed-81e7-b71061fc82ee/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `initialize'
/tmp/build_e8889be5-168c-49ed-81e7-b71061fc82ee/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `new'
...
/tmp/build_e8889be5-168c-49ed-81e7-b71061fc82ee/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
Tasks: TOP => environment
(See full trace by running task with --trace)
!
! Precompiling assets failed.
Run Code Online (Sandbox Code Playgroud)
zea*_*soi 28
来自Heroku文档:
这意味着您的应用程序正在尝试作为rake资产的一部分连接到数据库:预编译.由于配置变量不存在于环境中,因此我们使用占位符DATABASE_URL来满足Rails.
要解决此问题,请确保以下行显示在config/application.rb
:
# config/application.rb
config.assets.initialize_on_precompile = false
Run Code Online (Sandbox Code Playgroud)
添加后,提交您的更改并重新部署到Heroku - 您的资产应该编译,而您的应用程序不会尝试连接到数据库,这应该可以解决您正在目睹的错误.
更新:
stacktrace的第46行包含以下消息:Devise.secret_key was not set.
根据 Devise的作者JoséValim的说法,这个问题可以通过以下方式解决:
请将以下内容添加到您的Devise初始化程序中:
config.secret_key =' - 密钥 - '
或者,以下解决方案似乎适用于许多用户:
我去了routes.rb文件并注释掉了devise_for:installs行
然后我回去并重新设计了rails generate:install.如果这不起作用,请使用以前版本的设计,编辑Gemfile对Devise的引用,如下所示:gem'devise','3.0.3'然后按照我上面提到的步骤操作.
Dan*_*nny 11
有一些事情可以帮我解决这个问题:
# config/application.rb
config.assets.initialize_on_precompile = false
Run Code Online (Sandbox Code Playgroud)
然后,在我部署之前,我在本地编译了我的资产并提交了它们:
RAILS_ENV=production bundle exec rake assets:precompile
Run Code Online (Sandbox Code Playgroud)
另外,我安装了这个heroku add,正如我发布的应用程序所指定的那样(在我的情况下,Spree commerce)
heroku labs:enable user-env-compile -a myapp
Run Code Online (Sandbox Code Playgroud)
当然,请确保将database.yml文件设置为使用adapter: postgresql
.
承诺所有这一切,推送到heroku,并希望它将启动.如果您仍然无法打开您的应用,请尝试查看Heroku日志:heroku logs -n 500
我仍然需要迁移我的数据库 heroku run rake db:migrate
归档时间: |
|
查看次数: |
29582 次 |
最近记录: |