Tuesday, September 1, 2015

How to serve any static directory?

Hi all,

I'm working on an application where we want the following to happen:

1. The administrators upload zip archives containing web content (whole static websites) through admin interface
2. The archive is unzipped in the background to a random directory
3. The static content is served at a url that looks like http://<host>/site/<pk>/, with the index.html at the root, all the paths to css and js files, etc.

I know how to configure the route, but I was wondering what to put in the view. I have tried with STATIC_{ROOT,URL} and MEDIA_{ROOT,URL} but I feel it's not the right way.

In summary : is there a way to put something like `return serve_this_static_directory()` in the view? or is there any workaround there?

Thanks for your answers

Yann

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHDVCz73WP6MAC2VqYGkDYRw-vJCkd2fJXRUoZKyybrrjPAt4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment