librelist archives

« back to archive

Help: how to use X-Send-file

Help: how to use X-Send-file

From:
Lix Xu
Date:
2012-04-17 @ 03:28
Hi,
    I want to test use_x_sendfile to improve the performance.
    In the view file, I use send_file('static/temp/test.txt',
as_attachment=True)
    In the config file, I add USE_X_SENDFILE = True, and in the nginx
config file, I add:
    ...
    location /temp/ {
        internal;
        root /static;
    }
    ...

    For example, the file is in the path
/var/www/myapp/myapp/static/temp/test.txt.
    In the response headers, I can see one item:

X-Sendfile:
/var/www/myapp/myapp/static/temp/test.txt
    But it doesn't work.
    Is there any errors in the configuration?

    Thanks.