티스토리 뷰

공부

[Python] proxy image respnose content-type

승가비 2020. 7. 28. 23:15
728x90
def file(request, id):
    image = get_object_or_404(Image, pk=id)

    response = HttpResponse(urlopen(image.url).read())
    response['Content-Type'] = image.type
    return response

https://stackoverflow.com/questions/17548414/setting-content-type-in-django-httpresponse-object-for-shopify-app

 

Setting Content-Type in Django HttpResponse object for Shopify App

I'm working on a Shopify app using Django, which I am hosting on a VPS with nginx and gunicorn. I am trying to change the Content-Type of an HttpResponse object to application/liquid, so that I ca...

stackoverflow.com

 

728x90

'공부' 카테고리의 다른 글

[Python] substring; s[index:]  (0) 2020.08.05
[Python] url open  (0) 2020.07.28
[Linux] install python mysql  (0) 2020.07.28
[Django] not like statement  (0) 2020.07.28
[Django] filter query  (0) 2020.07.28
댓글