2

私のdjangoアプリは、シンプルな共有DBを使ってheroku(gunicornで動作)上にあり、イメージはs3に保存されています。問題は、ページに数枚以上の画像があると、応答が非常に遅くなり(30〜60秒)なります。この状況でのベストプラクティスに関するヒントAWS S3にイメージキットを保存したherokuのDjangoは非常に遅い

設定:

#AWS login details etc 
from S3 import CallingFormat 
AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN 

ベーシックモデルは次のようになります。

models.py

class TestModel(models.Model): 
    original_image = models.ImageField(storage=s3_storage, upload_to='uploads/%Y/%m/%d') 
    thumb_image = ImageSpec([resize.Fit(402)], image_field='original_image', storage=s3_storage, format='JPEG', options={'quality': 90}) 
    formatted_image = ImageSpec([resize.Fit(800)], image_field='original_image', storage=s3_storage, format='JPEG', options={'quality': 90}) 

と簡略図:

views.py

def home(request): 
    images = TestModel.objects.filter(published=True) 
    ctxt = {} 
    ctxt['image'] = images 
    return render_to_response('home.html', ctxt, RequestContext(request)) 

テンプレート:

{% for image in images %} 
     <img src="{{ image.thumb_image.url }}" alt=""> 
    {% endfor %} 
+1

http://stackoverflow.com/questions/3866635/django-image-storage-cdnを参照してください。 –

答えて

1

私はあなたが右のWebダイノであなたのイメージのサイズを変更するためであると思い、そうではありませんか?

ワーカーダイノーで行う必要があります。

関連する問題