How do I access protected directories using Django? I have the following 
configuration but is not working, there is always page 404 when I try to 
access the directory.

*Django:*

def test(request):
    file_url = 'http://mysite.com/media/users/avatar.png'
    response = HttpResponse()
    response['X-Accel-Redirect'] = file_url
    return response

*Nginx:*

server {
    listen 80;
    server_name mysite.com;

    location /media/ {
        internal;
        alias /home/ubuntu/webapps/myapp/media/;
    }
}



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c965f092-bf02-4146-8a5f-2e5f7fef90db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to