私は、nginx と gunicorn を使用して VPS でホストしている Django を使用して Shopify アプリに取り組んでいます。
application/liquid
Shopify のアプリケーション プロキシ機能を使用できるように、HttpResponse オブジェクトの Content-Type を に変更しようとしていますが、機能していないようです。
これが私のコードの関連セクションであると私が信じているものです:
from django.shortcuts import render_to_response, render
from django.http import HttpResponse
from django.template import RequestContext
import shopify
from shopify_app.decorators import shop_login_required
def featured(request):
response = HttpResponse()
response['content_type'] = 'application/liquid; charset=utf-8'
response['content'] = '<html>test123</html>'
response['Content-Length'] = len(response.content)
return response
Django docsによると、ヘッダーresponse[''content_type]
に設定するために設定する必要があります。Content-Type
残念ながら、views.py でこの関数に対応する URL にアクセスすると、200 応答が返されますが、Content-Type は変更されておらず、Content-Length は 0 です。応答ヘッダーは次のとおりです。
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 09 Jul 2013 12:26:59 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 0
Connection: keep-alive
X-Request-Id: 2170c81fb16d18fc9dc056780c6d92fd
content: <html>test123</html>
vary: Cookie
content_type: application/liquid; charset=utf-8
P3P: CP="NOI DSP COR NID ADMa OPTa OUR NOR"
に変更response['content_type']
するとresponse['Content-Type']
、次のヘッダーが表示されます。
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 09 Jul 2013 12:34:09 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 3097
Connection: keep-alive
X-Request-Id: 76e67e04b753294a3c37c5c160b42bcb
vary: Accept-Encoding
status: 200 OK
x-shopid: 2217942
x-request-id: 6e63ef3a27091c73a9e3fdaa03cc28cb
x-ua-compatible: IE=Edge,chrome=1
p3p: CP="NOI DSP COR NID ADMa OPTa OUR NOR"
content-encoding: gzip
P3P: CP="NOI DSP COR NID ADMa OPTa OUR NOR"
応答の Content-Type を変更する方法についてのアイデアはありますか? これは、nginx または gunicorn の構成に問題があるのでしょうか?
ご協力いただきありがとうございます!