The way to do this is by utilizing nginx as a reverse proxy for your
dynamic django (presumably apache) server and a peer media server
(presumably another nginx setup). Nginx has a great feature (as does
lighttpd) where you can have your page request come into django and
perform all the authN/authZ checks needed for your static content but
redirect the request to the static media server once approved.

Let's say you have a user profile with pictures and want the user to
have find grained privacy control on his pictures.
1. request for user profile comes into nginx proxy.
2. nginx proxy fwds request to django server which determines which
pics are appropriate to view (authorized) of that profile for the
logged in user.
3. the django server, rather than returning static links to the media
server, populates a field X-Accel-Redirect that points to the static
content on the media server.
4. nginx proxy sees the X-Accel-Redirect contents and resubmits the
request to the media server and returns its content instead of the
content from the django server.
5. user gets only the static content that the django server authorized
yet the load for the transfer is moved to the media server.

Good luck,

  -- Ben

On Feb 16, 4:44 pm, MrMuffin <thomas.weh...@gmail.com> wrote:
> I`m using django to develop something similar to flickr, a site for
> photo-sharing. Photos can be public, need authentication or be
> personal and not available for anyone but the owner. Serving static
> data using django is not optimal, but how can I control access like
> this when serving static media using apache or nginx?
>
> Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to