Using upload fixtures in GAE

15 views
Skip to first unread message

Tiago Rosa

unread,
Oct 18, 2010, 7:38:01 PM10/18/10
to web2py-users
Hi folks,

I've recently created some fixture files to prepopulate my
application's database with some data I need to be there from the
beginning. The fixtures are basically files located under the 'models'
directory that contain insert statements (and checks to only execute
the inserts if the table is empty). Like this:

if db(db.professores.id > 0).count() == 0:
db.professores.insert(id=1, email='fla...@inf.ufrgs.br',
short_name='Flávio', full_name='Flávio Rech Wagner', site='http://
www.inf.ufrgs.br/~flavio')
db.professores.insert(id=2, email='la...@inf.ufrgs.br',
short_name='Lamb', full_name='Luís da Cunha Lamb', site='http://
www.inf.ufrgs.br/~lamb')
db.professores.insert(id=3, email='heu...@inf.ufrgs.br',
short_name='Heuser', full_name='Carlos Alberto Heuser', site='http://
www.inf.ufrgs.br/~heuser')

The problem is: I need to have a upload field called 'picture' that,
oh well, keeps a picture. And I need to prepopulate this field in the
fixture, just like the other fields. But my application is GAE-
deployed, and I haven't found a way to do this in a sane way. Do
someone have an idea on how to do that elegantly?

Any help will be greatly appreciated.

Thanks in advance!

Best regards,

Tiago Rosa

Wikus van de Merwe

unread,
Oct 19, 2010, 8:59:32 AM10/19/10
to web2py-users
This is not really web2py related question. You can use either the GAE
Bulk Loader:
http://code.google.com/appengine/docs/python/tools/uploadingdata.html
or the remote API directly:
http://stackoverflow.com/questions/774265/how-do-i-bulkupload-image-blobs-in-google-app-engine

Alternatively you may decide to store just the paths to images which
you upload to GAE as static data.
Reply all
Reply to author
Forward
0 new messages