【问题标题】:Config cloudinary for development and production为开发和生产配置 cloudinary
【发布时间】:2015-07-17 17:24:40
【问题描述】:

在我的 Rails 应用中,我使用carrierwave 和cloudinary 来上传图片。

我设置了配置文件 cloudinary.yml 并且一切正常。

development:
  cloud_name: _my_app_name_
  api_key: '_my_cloudinary-key_'
  api_secret: _my_cloudinary_secret_
  enhance_image_tag: true
  static_image_support: false
production:
  cloud_name: _my_app_name_
  api_key: '_my_cloudinary-key_'
  api_secret: _my_cloudinary_secret_
  enhance_image_tag: true
  static_image_support: true
test:
  cloud_name: _my_app_name_
  api_key: '_my_cloudinary-key_'
  api_secret: _my_cloudinary_secret_
  enhance_image_tag: true
  static_image_support: false

如何将 cloudinary 配置为仅用于生产?

对于开发,只使用本地存储。

【问题讨论】:

    标签: ruby-on-rails config cloudinary


    【解决方案1】:

    您可以在上传器中使用类似以下内容:

    storage :file unless Rails.env == "production"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-14
      • 1970-01-01
      • 2012-09-11
      • 1970-01-01
      • 2020-02-25
      • 2018-03-08
      • 1970-01-01
      • 2016-06-04
      相关资源
      最近更新 更多