web2py PDF - Where do I put this code?
http://code.google.com/p/pyfpdf/wiki/Web2Py#Sample_Table_Listing
This would be my first time using web2py, I'm using it because the example code is exactly what I need f开发者_如何学JAVAor part of a project.
My problem is I have no idea where to put this code. I'm using Google App Engine.
To understand where to put that code, you'll need at least a basic understanding of how web2py applications are structured. I recommend at least looking at the Overview chapter of the book.
The function definitions shown (i.e., report()
, listing()
, and invoice()
) would go in a controller file in your applications's '/controllers' folder (the scaffolding application includes a 'default.py' controller file, though you could rename that or create a new controller file). The calls to db.define_table
would typically go in a model file in your application's '/models' folder (the scaffolding application includes a 'db.py' model file, though again, you could rename that or create a new model file).
Note, there was a recent discussion on the mailing list regarding getting pyfpdf to work on GAE.
精彩评论