views:

23

answers:

1

Greetings, By using Django, I want to generate a tar.gz which contains the files below, and render a tar.gz file:

Content from an Ubuntu server:

/home/user/myfolder
/home/user/image.jpg
an xml file from www.mysite.com/foo.xml (which is a dynamicly generated xml file.

Rendered tar.gz file

myfolder/
         content/
          .....
image.jpg
foo.xml

What would be the best way to do this inside achieve this as a Django view?

+2  A: 

The tarfile module is probably a good place to start.

You would probably want to cache the file somewhere in the filesystem to save yourself from too much work. There's no reason to regenerate the file if the contents haven't changed.

scompt.com