Make a simple model for storing files:
db.define_table("files",
db.Field("name"),
db.Field("content", "text"))
Then use a function similar to the one below to download the file:
def download():
file = db.files(request.args[0])
if not file:
raise HTTP(404, "File not found.")
response.headers["Content-Type"] = "text/plain"
response.headers["Content-Disposition"] = "attachment; filename=%s.txt"
% file.name
response.headers["Content-Title"] = file.name+".txt"
response.headers['Content-Length'] = len(file.content)
return file.content
For binary content use db.Field("content", "blob"). If it is a large file,
use the blobstore API instead:
http://code.google.com/appengine/docs/python/blobstore/overview.html