2

ユーザー ダウンロード用のサーバー ファイルの提供に問題があります。mod_xsendfile で Apache を使用しています。まず、開発サーバーにファイルをダウンロードしようとすると、ファイルは 0 バイトです。次に、Apache を使用してファイルを提供しようとすると、エラーが発生します。

SuspiciousOperation: 行 document.file.path で ***** へのアクセスが拒否されました

file_name = document.file.name          
response = HttpResponse(mimetype='application/force-download')
response['Content-Disposition'] = 'attachment; filename=%s' % smart_str(file_name)
response['X-Sendfile'] = document.file.path
return response

「Xsend On」で mod_xsend を構成しました。助けに感謝します

4

1 に答える 1

2

Pythonコードは私にはojに見えます。Apache構成では、次の例のようにmode_xsendfileを構成する必要があります。

<Files *.*>
XSendFile on
XSendFilePath /absolute/path/to/your/files
</Files>

また、mod_xsendfile が正しくロードされていることを確認してください。

于 2012-09-12T07:33:11.390 に答える