How to access a static file in controller in turbogears
I have an XML file in /my_project/public/xml/file.xml, that I want to read and parse it in one method in controller. The file can be easily accessed through a template, bu开发者_如何学编程t I have no experience with accessing files in controller.
the more simple I know :
jest get the diname of base of the project
filename = os.path.join(os.path.dirname(myproject.__file__), 'public', 'xml', 'file.xml')
精彩评论