Here is an example:

easy_install pyfilesystem

>>> import fs.s3fs
>>> myfs = fs.s3fs.S3FS(bucket, prefix, aws_access_ke, aws_secret_key)
>>> db.define_table('test',Field('file','upload',uploadfs = myfs))

Now all your uploaded files will go on S3.
Here is a list of supported 
filesystems: http://packages.python.org/fs/filesystems.html

WARNINGS: 
- needs testing. I have tested with OSFS and I am confident it works
- I do not think with will work on GAE, should be tested
- uploadfolder and uploadseparate are ignored when uploadfs is specified 
(this should be changed, any takers?)

Should be possible to wrap myfs into an encryption layer but I have not 
done it yet.

We may want a more comprehensive strategy and allow every web2py file 
(including apps, sessions, tickets, etc) to go into a pyfilesystem. Is this 
necessary? On linux one can mount filesystems in a folder anyway. Is this 
more trouble than it is worth?

Massimo





Reply via email to