0
私のdjangoアプリはpythonスクリプト(query.cgi)を呼び出します。しかし、私はそれを実行すると、Webページとして出力を表示する代わりに、そのスクリプトからhtmlの印刷出力が表示されます。djangoがPythonスクリプトを呼び出すと、Webページの代わりにhtmlコードが表示されます
def query(request):
if request.method == 'GET':
output = subprocess.check_output(['python', 'query.cgi']).decode('utf-8')
return HttpResponse(output, content_type="text/plain")
Webページでは示しています。任意のヘルプ
Content-Type: text/html
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="css/css_4.css" media="screen" />
<title>....</title>
</head><body>.....</body></html>
感謝を!
ありがとうございました!それはうまくいった! – user2607925