Rails教程第11章Carrierwave和Cloudinary。 Heroku应用程序错误

时间:2016-01-21 12:51:06

标签: ruby-on-rails ruby heroku carrierwave cloudinary

我正在关注Rails教程并且不使用AWS,因为我没有信用卡。

所以我尝试使用Cloudinary。

我是一个完整的菜鸟,我甚至不确定是否可以做到。 关键是我想在heroku上删除我的网站,我可以上传图片。

它通过localhost工作正常,但在heroku上有这个错误:

No command 'run' found, did you mean:
 Command 'runq' from package 'sendmail-bin' (universe)
 Command 'runq' from package 'exim4-daemon-heavy' (main)
 Command 'runq' from package 'exim4-daemon-light' (main)
 Command 'rn' from package 'trn' (multiverse)
 Command 'rn' from package 'trn4' (multiverse)
 Command 'qrun' from package 'torque-client-x11' (universe)
 Command 'qrun' from package 'torque-client' (universe)
 Command 'srun' from package 'slurm-llnl' (universe)
 Command 'zrun' from package 'moreutils' (universe)
 Command 'grun' from package 'grun' (universe)
 Command 'rup' from package 'rstat-client' (universe)
run: command not found
budi@Lenovo:~/sample_app$ heroku run rake console
Running rake console on rocky-badlands-7040... up, run.6999
rake aborted!
Don't know how to build task 'console'

(See full trace by running task with --trace)
budi@Lenovo:~/sample_app$ heroku run rake console --trace
Running rake console --trace on rocky-badlands-7040... up, run.7578
rake aborted!
Don't know how to build task 'console'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task_manager.rb:62:in `[]'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:149:in `invoke_task'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `<main>'

my picture_uploader.rb

# encoding: utf-8

class PictureUploader < CarrierWave::Uploader::Base

  # Include RMagick or MiniMagick support:
  # include CarrierWave::RMagick

   include CarrierWave::MiniMagick
   process resize_to_limit: [400, 400]
  include Cloudinary::CarrierWave


   # process :tags => ['post_picture']

#   version :standard do
#    process :resize_to_fill => [200, 300, :north]
#  end

#  version :thumbnail do
#    resize_to_fit(50,50)
#  end

#  def public_id
#    return model.short_name
#  end

  # Choose what kind of storage to use for this uploader:
  if Rails.env.production?
    #storage :cloudinary
     storage :fog
  else
    storage :file
  end


  # Override the directory where uploaded files will be stored.
  # This is a sensible default for uploaders that are meant to be mounted:
  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end

  # Provide a default URL as a default if there hasn't been a file uploaded:
  # def default_url
  #   # For Rails 3.1+ asset pipeline compatibility:
  #   # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
  #
  #   "/images/fallback/" + [version_name, "default.png"].compact.join('_')
  # end

  # Process files as they are uploaded:
  # process :scale => [200, 300]
  #
  # def scale(width, height)
  #   # do something
  # end

  # Create different versions of your uploaded files:
  # version :thumb do
  #   process :resize_to_fit => [50, 50]
  # end

  # Add a white list of extensions which are allowed to be uploaded.
  # For images you might use something like this:
   def extension_white_list
     %w(jpg jpeg gif png)
   end

  # Override the filename of the uploaded files:
  # Avoid using model.id or version_name here, see uploader/store.rb for details.
  # def filename
  #   "something.jpg" if original_filename
  # end

end

通过localhost,它工作正常。 enter image description here

在heroku上,根本没有显示。 enter image description here

heroku logs -t

budi@Lenovo:~/sample_app$ heroku logs -t
2016-01-21T12:10:52.739963+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
2016-01-21T12:10:52.739964+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
2016-01-21T12:10:52.739966+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
2016-01-21T12:10:52.739967+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/puma-2.11.1/lib/puma/configuration.rb:107:in `app'
2016-01-21T12:10:52.739968+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/puma-2.11.1/lib/puma/runner.rb:113:in `load_and_bind'
2016-01-21T12:10:52.739968+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/puma-2.11.1/lib/puma/cluster.rb:301:in `run'
2016-01-21T12:10:52.739970+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/puma-2.11.1/lib/puma/cli.rb:512:in `run'
2016-01-21T12:10:52.739971+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/puma-2.11.1/bin/puma:10:in `<top (required)>'
2016-01-21T12:10:52.739972+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/bin/puma:23:in `load'
2016-01-21T12:10:52.739974+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/bin/puma:23:in `<main>'
2016-01-21T12:10:53.552732+00:00 heroku[web.1]: Process exited with status 1
2016-01-21T12:10:53.541907+00:00 heroku[web.1]: State changed from starting to crashed
2016-01-21T12:11:13.076187+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=rocky-badlands-7040.herokuapp.com request_id=0cbb3342-7b1e-4bfa-8fd5-8b7073f4ea8b fwd="118.96.108.186" dyno= connect= service= status=503 bytes=
2016-01-21T12:11:17.866525+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=rocky-badlands-7040.herokuapp.com request_id=d76107d2-5ca9-4bc2-b8eb-f4160e777161 fwd="118.96.108.186" dyno= connect= service= status=503 bytes=
2016-01-21T12:17:35.810665+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=rocky-badlands-7040.herokuapp.com request_id=115145da-9cdb-4883-bcc0-ec00a176757a fwd="118.96.108.186" dyno= connect= service= status=503 bytes=
2016-01-21T12:57:57.028909+00:00 heroku[web.1]: State changed from crashed to starting
2016-01-21T12:57:59.871803+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
2016-01-21T12:58:02.536102+00:00 app[web.1]: [3] Puma starting in cluster mode...
2016-01-21T12:58:02.536157+00:00 app[web.1]: [3] * Version 2.11.1 (ruby 2.0.0-p648), codename: Intrepid Squirrel
2016-01-21T12:58:02.536190+00:00 app[web.1]: [3] * Min threads: 5, max threads: 5
2016-01-21T12:58:02.536225+00:00 app[web.1]: [3] * Environment: production
2016-01-21T12:58:02.536258+00:00 app[web.1]: [3] * Process workers: 2
2016-01-21T12:58:02.536292+00:00 app[web.1]: [3] * Preloading application
2016-01-21T12:58:08.277527+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:73:in `eval': no implicit conversion of nil into String (TypeError)
2016-01-21T12:58:08.275816+00:00 app[web.1]: [3] ! Unable to load application: TypeError: no implicit conversion of nil into String
2016-01-21T12:58:08.277534+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:73:in `storage'
2016-01-21T12:58:08.277536+00:00 app[web.1]:    from /app/app/uploaders/picture_uploader.rb:29:in `<class:PictureUploader>'
2016-01-21T12:58:08.277536+00:00 app[web.1]:    from /app/app/uploaders/picture_uploader.rb:3:in `<top (required)>'
2016-01-21T12:58:08.277537+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:274:in `require'
2016-01-21T12:58:08.277538+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:274:in `block in require'
2016-01-21T12:58:08.277538+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:240:in `load_dependency'
2016-01-21T12:58:08.277539+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:274:in `require'
2016-01-21T12:58:08.277539+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:360:in `require_or_load'
2016-01-21T12:58:08.277540+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:494:in `load_missing_constant'
2016-01-21T12:58:08.277540+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:184:in `const_missing'
2016-01-21T12:58:08.277541+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:526:in `load_missing_constant'
2016-01-21T12:58:08.277541+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:184:in `const_missing'
2016-01-21T12:58:08.277542+00:00 app[web.1]:    from /app/app/models/micropost.rb:4:in `<class:Micropost>'
2016-01-21T12:58:08.277544+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:274:in `block in require'
2016-01-21T12:58:08.277549+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.2/lib/rails/engine.rb:471:in `block in eager_load!'
2016-01-21T12:58:08.277546+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:317:in `depend_on'
2016-01-21T12:58:08.277546+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:360:in `require_or_load'
2016-01-21T12:58:08.277544+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:240:in `load_dependency'
2016-01-21T12:58:08.277548+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.2/lib/rails/engine.rb:471:in `each'
2016-01-21T12:58:08.277543+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:274:in `require'
2016-01-21T12:58:08.277545+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:274:in `require'
2016-01-21T12:58:08.277547+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:233:in `require_dependency'
2016-01-21T12:58:08.277547+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.2/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
2016-01-21T12:58:08.277549+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.2/lib/rails/engine.rb:469:in `each'
2016-01-21T12:58:08.277550+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.2/lib/rails/engine.rb:469:in `eager_load!'
2016-01-21T12:58:08.277543+00:00 app[web.1]:    from /app/app/models/micropost.rb:1:in `<top (required)>'
2016-01-21T12:58:08.277551+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.2/lib/rails/engine.rb:346:in `eager_load!'
2016-01-21T12:58:08.277551+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.2/lib/rails/application/finisher.rb:56:in `each'
2016-01-21T12:58:08.277552+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.2/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
2016-01-21T12:58:08.277553+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.2/lib/rails/initializable.rb:30:in `instance_exec'
2016-01-21T12:58:08.277553+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.2/lib/rails/initializable.rb:30:in `run'
2016-01-21T12:58:08.277554+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.2/lib/rails/initializable.rb:55:in `block in run_initializers'
2016-01-21T12:58:08.277554+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
2016-01-21T12:58:08.277555+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
2016-01-21T12:58:08.277556+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
2016-01-21T12:58:08.277556+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
2016-01-21T12:58:08.277557+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
2016-01-21T12:58:08.277561+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
2016-01-21T12:58:08.277561+00:00 app[web.1]:    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
2016-01-21T12:58:08.277562+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.2/lib/rails/initializable.rb:54:in `run_initializers'
2016-01-21T12:58:08.277563+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.2/lib/rails/application.rb:352:in `initialize!'
2016-01-21T12:58:08.277563+00:00 app[web.1]:    from /app/config/environment.rb:5:in `<top (required)>'
2016-01-21T12:58:08.277564+00:00 app[web.1]:    from config.ru:3:in `require'
2016-01-21T12:58:08.277565+00:00 app[web.1]:    from config.ru:3:in `block in <main>'
2016-01-21T12:58:08.277566+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
2016-01-21T12:58:08.277566+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
2016-01-21T12:58:08.277567+00:00 app[web.1]:    from config.ru:in `new'
2016-01-21T12:58:08.277567+00:00 app[web.1]:    from config.ru:in `<main>'
2016-01-21T12:58:08.277568+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
2016-01-21T12:58:08.277569+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
2016-01-21T12:58:08.277569+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
2016-01-21T12:58:08.277570+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/puma-2.11.1/lib/puma/configuration.rb:107:in `app'
2016-01-21T12:58:08.277571+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/puma-2.11.1/lib/puma/runner.rb:113:in `load_and_bind'
2016-01-21T12:58:08.277571+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/puma-2.11.1/lib/puma/cluster.rb:301:in `run'
2016-01-21T12:58:08.277572+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/puma-2.11.1/lib/puma/cli.rb:512:in `run'
2016-01-21T12:58:08.277572+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/puma-2.11.1/bin/puma:10:in `<top (required)>'
2016-01-21T12:58:08.277573+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/bin/puma:23:in `load'
2016-01-21T12:58:08.277574+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/bin/puma:23:in `<main>'
2016-01-21T12:58:09.332125+00:00 heroku[web.1]: Process exited with status 1
2016-01-21T12:58:09.347367+00:00 heroku[web.1]: State changed from starting to crashed
2016-01-21T13:03:51.533641+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=rocky-badlands-7040.herokuapp.com request_id=64d84af0-fd70-4b8f-bf2b-4849cb0f8062 fwd="118.96.108.186" dyno= connect= service= status=503 bytes=
2016-01-21T13:04:03.964797+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=rocky-badlands-7040.herokuapp.com request_id=6d8f88e0-d869-4e61-82a7-e2d31cc69f79 fwd="118.96.108.186" dyno= connect= service= status=503 bytes=
2016-01-21T13:07:20.527352+00:00 heroku[api]: Starting process with command `bundle exec rake console` by mulyantobudi26@yahoo.com
2016-01-21T13:07:23.429111+00:00 heroku[run.1056]: Starting process with command `bundle exec rake console`
2016-01-21T13:07:23.412162+00:00 heroku[run.1056]: Awaiting client
2016-01-21T13:07:23.785983+00:00 heroku[run.1056]: State changed from starting to up
2016-01-21T13:07:27.940357+00:00 heroku[run.1056]: Process exited with status 1
2016-01-21T13:07:27.974214+00:00 heroku[run.1056]: State changed from up to complete
2016-01-21T13:08:11.876711+00:00 heroku[api]: Starting process with command `rails console` by mulyantobudi26@yahoo.com
2016-01-21T13:08:15.285484+00:00 heroku[run.8698]: Starting process with command `rails console`
2016-01-21T13:08:15.249919+00:00 heroku[run.8698]: Awaiting client
2016-01-21T13:08:15.660609+00:00 heroku[run.8698]: State changed from starting to up
2016-01-21T13:08:19.669455+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=rocky-badlands-7040.herokuapp.com request_id=dfad28a4-e6bf-4e70-9218-48dcf7bb950a fwd="118.96.108.186" dyno= connect= service= status=503 bytes=
2016-01-21T13:08:23.018799+00:00 heroku[run.8698]: State changed from up to complete
2016-01-21T13:08:23.004693+00:00 heroku[run.8698]: Process exited with status 1
2016-01-21T13:16:44.227321+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=rocky-badlands-7040.herokuapp.com request_id=a7c99802-285a-4b0b-9faf-b5cefb8a5526 fwd="118.96.108.186" dyno= connect= service= status=503 bytes=

修改

现在显示在heroku上。

我添加了这个

# Ignore uploaded test images.
/public/uploads

但是,当我运行'heroku run rake db:seed'时仍然会出现此错误 这不是完整的日志,只是错误部分。它显示在日志的末尾。

rake aborted!
NameError: undefined local variable or method `at' for main:Object
/app/db/seeds.rb:28:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `load'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `block in load'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:240:in `load_dependency'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `load'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.2/lib/rails/engine.rb:547:in `load_seed'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.2/lib/active_record/tasks/database_tasks.rb:250:in `load_seed'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.2/lib/active_record/railties/databases.rake:180:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)

网站显示种子没有微博,无法上传图片。 enter image description here

修改

无法上传图像文件时的日志。

2016-01-21T14:27:46.690137+00:00 app[web.1]:   SQL (4.7ms)  INSERT INTO "microposts" ("content", "picture", "user_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"  [["content", "tbbt"], ["picture", "tbbt.jpg"], ["user_id", 1], ["created_at", "2016-01-21 14:27:46.684003"], ["updated_at", "2016-01-21 14:27:46.684003"]]
2016-01-21T14:27:46.693068+00:00 app[web.1]: Completed 500 Internal Server Error in 313ms (ActiveRecord: 8.0ms)
2016-01-21T14:27:46.380264+00:00 app[web.1]: Processing by MicropostsController#create as HTML
2016-01-21T14:27:46.380370+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"be6ZVkdmeCpsEXL3AkMrwH8oQAc3IMoBcemINp9pR0Iqn/O4GHpHtuoDeBjKJHd39Ybxi8oeS0jCI/cH3BMFPg==", "micropost"=>{"content"=>"tbbt", "picture"=>#<ActionDispatch::Http::UploadedFile:0x007fcad04cbc40 @tempfile=#<Tempfile:/tmp/RackMultipart20160121-10-hcrp4r.jpg>, @original_filename="tbbt.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"micropost[picture]\"; filename=\"tbbt.jpg\"\r\nContent-Type: image/jpeg\r\n">}, "commit"=>"Post"}
2016-01-21T14:27:46.382705+00:00 app[web.1]:   User Load (1.3ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1  [["id", 1]]
2016-01-21T14:27:46.682425+00:00 app[web.1]:    (1.0ms)  BEGIN
2016-01-21T14:27:46.691979+00:00 app[web.1]:    (0.9ms)  ROLLBACK
2016-01-21T14:27:46.694809+00:00 app[web.1]: 
2016-01-21T14:27:46.694811+00:00 app[web.1]: ArgumentError ( is not a recognized provider):
2016-01-21T14:27:46.694813+00:00 app[web.1]:   app/controllers/microposts_controller.rb:7:in `create'
2016-01-21T14:27:46.694813+00:00 app[web.1]: 
2016-01-21T14:27:46.694814+00:00 app[web.1]: 
2016-01-21T14:27:46.378030+00:00 app[web.1]: Started POST "/microposts" for 118.96.108.186 at 2016-01-21 14:27:46 +0000
2016-01-21T14:27:46.697921+00:00 heroku[router]: at=info method=POST path="/microposts" host=rocky-badlands-7040.herokuapp.com request_id=4539cf2e-302b-4c95-b01d-f6abe4bd27ce fwd="118.96.108.186" dyno=web.1 connect=0ms service=2452ms status=500 bytes=1714

`

1 个答案:

答案 0 :(得分:0)

运行heroku run rails console而非rake