0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Django3.x + heroku + cloudinaryを使用する方法

Last updated at Posted at 2020-04-20

背景

  • Djangoをherokuにデプロイするにあたり、画像データを保存するにはS3とcloudinaryが知られている。
  • cloudinaryを簡単に扱うには、django-cloudinary-storageがよく利用されているが、django2.x系のみ対応

概要

  • Django3.x系を使うには、dj3-cloudinary-storageを使ってみよう。
    • django-cloudinary-storageのソースのままでほぼ使用可能

動作確認

  • 動作確認OK
blog.html
<a href="{% url 'blog:post_detail' post.id %}">
     <img class="card-img-top" src="{{ post.image.url }}" alt="{{ post.title }}">
</a>
  • 画像表示されず
blog.html
<a href="{% url 'blog:post_detail' post.id %}">
     <img class="card-img-top" src="{{ test_model_instance.image.url }}" alt="{{ test_model_instance.image.name }}">
</a>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?