技术探索:Google App Engine 查询、Zenoss 管理及 Python 包管理
在软件技术领域,我们常常会遇到各种实用且有趣的工具和技术。下面将为大家介绍 Google App Engine 的查询操作、使用 Zenoss 从 Linux 管理 Windows 服务器以及 Python 包管理的相关内容。
1. Google App Engine 查询操作
在 Google App Engine 中,我们可以通过以下代码从数据存储中获取最后 10 条记录:
collection = [] #grab last 10 records from datastore query = ChangeModel.all().order('-date') records = query.fetch(limit=10) #formats decimal correctly for change in records: collection.append(decimal.Decimal(change.input)/100) template_values = { 'inputs': collection, 'records': records, } path = os.path.join(os.path.dirname(__file__), 'query.html') self.response.out.write(template.render(path,template_values))其中,关键的两行代码是: