简体   繁体   English

Cloudinary仅在本地工作,不在生产中

[英]Cloudinary only works locally and not in production

I have a problem with deploying my app on heroku ... it's been several hours since I tried to use Cloudinary with my Heroku app. 我在heroku上部署我的应用程序时遇到问题...自从尝试在我的Heroku应用程序中使用Cloudinary以来已经有几个小时了。

I followed literally different tutorials from Cloudinary. 我遵循了与Cloudinary完全不同的教程。

EDIT When I download photos on my local app, i find them on Cloudinary ! 编辑当我在本地应用程序上下载照片时,可以在Cloudinary上找到它们! How to make it also on my Heroku app ? 如何在我的Heroku应用程序上也进行制作? :/ :/

Gemfile 的Gemfile

# paperclip
gem 'paperclip'
gem 'paperclip-cloudinary'

config/cloudinary.yml 配置/ cloudinary.yml

production:
  cloud_name: hoxr8ugj3
  api_key: 'xxx'
  api_secret: xxxx
  enhance_image_tag: true
  static_image_support: true

models/photo.rb 车型/ photo.rb

class Photo < ApplicationRecord
    belongs_to :projet

    has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" }
    validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/ 
  end

config/environments/production.rb 配置/环境/ production.rb

  Paperclip::Attachment.default_options.merge!({
    :storage => :cloudinary,
    :path => ':id/:style/:filename'
  })

Everything works perfectly locally ... I do not understand! 一切都在本地完美运行...我不明白! :( :(

With git push heroku master , i get this warning You set your config.active_storage.service to :local in production. 随着git push heroku master ,我收到此警告You set your to :local in production. You set your config.active_storage.service You set your to :local in production.

I probably need to change some things in storage.yml ? 我可能需要更改storage.yml某些内容? or create secret.yml ? 或创建secret.yml吗? but how ? 但是如何?

storage.yml storage.yml

test:
  service: Disk
  root: <%= Rails.root.join("tmp/storage") %>

local:
  service: Disk
  root: <%= Rails.root.join("storage") %>

I also tried : 我也尝试过:

heroku config:add CLOUDINARY_URL=....

heroku logs error : heroku记录错误:

ate (1.5ms)  INSERT INTO "photos" ("projet_id", "created_at", "updated_at", "image_file_name", "image_content_type", "image_file_size", "image_updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"  [["projet_id", 1], ["created_at", "2018-11-15 12:07:04.278472"], ["updated_at", "2018-11-15 12:07:04.278472"], ["image_file_name", "zenploylogo.png"], ["image_content_type", "image/png"], ["image_file_size", 21847], ["image_updated_at", "2018-11-15 12:07:03.988840"]]
2018-11-15T12:07:04.443055+00:00 app[web.1]: D, [2018-11-15T12:07:04.442918 #4] DEBUG -- : [5e1f39fa-7d71-4b07-bc23-2696425689d8]    (1.0ms) ROLLBACK
2018-11-15T12:07:04.443536+00:00 app[web.1]: I, [2018-11-15T12:07:04.443455 #4]  INFO -- : [5e1f39fa-7d71-4b07-bc23-2696425689d8] Completed 500 Internal Server Error in 523ms (ActiveRecord: 9.6ms)
2018-11-15T12:07:04.444215+00:00 app[web.1]: F, [2018-11-15T12:07:04.444142 #4] FATAL -- : [5e1f39fa-7d71-4b07-bc23-2696425689d8]
2018-11-15T12:07:04.444288+00:00 app[web.1]: F, [2018-11-15T12:07:04.444211 #4] FATAL -- : [5e1f39fa-7d71-4b07-bc23-2696425689d8] KeyError (key not found: :ciphers):
2018-11-15T12:07:04.444339+00:00 app[web.1]: F, [2018-11-15T12:07:04.444280 #4] FATAL -- : [5e1f39fa-7d71-4b07-bc23-2696425689d8]
2018-11-15T12:07:04.444393+00:00 app[web.1]: F, [2018-11-15T12:07:04.444338 #4] FATAL -- : [5e1f39fa-7d71-4b07-bc23-2696425689d8] app/controllers/projets_controller.rb:63:in `block in update'

Thank you very much for your help and sorry for my english. 非常感谢您的帮助,对不起我的英语。

This issue has to do with a bug in the Cloudinary gem update to 1.10.0. 此问题与Cloudinary gem更新至1.10.0中的错误有关。 See https://github.com/cloudinary/cloudinary_gem/issues/322 参见https://github.com/cloudinary/cloudinary_gem/issues/322

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Rails,Heroku,Cloudinary:虽然在本地工作,但照片在生产中未上传到 cloudinary - Rails, Heroku, Cloudinary: Photos not uploading to cloudinary in production, although working locally Rails记录更新在本地工作,但不在生产中 - Rails record update works locally but not in production Rails 应用程序在本地工作,但不适用于 Heroku 的生产环境 - Rails App works locally, but not in production with Heroku jQuery / Datepicker在本地工作,但不在生产环境中使用(heroku) - Jquery/Datepicker works locally but not in production (heroku) Mailform 在本地工作但不在生产中(Heroku、Rails) - Mailform works locally but not in production (Heroku, Rails) 配置cloudinary以进行开发和生产 - Config cloudinary for development and production 回形针,Cloudinary,开发,生产 - Paperclip, Cloudinary, Development, Production Javascript资产未加载到已部署的Heroku应用(生产)中,但在本地运行良好 - Javascript assets not loading to deployed Heroku app(Production), but works fine locally Rails App可在本地运行,但在Heroku上生产时出现错误 - Rails App works locally but giving an error on production on Heroku rails export csv在生产中返回空状态,在本地运行良好 - rails export csv return empty in production which works fine locally
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM