本文整理汇总了Python中models.Server.query_all方法的典型用法代码示例。如果您正苦于以下问题:Python Server.query_all方法的具体用法?Python Server.query_all怎么用?Python Server.query_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Server
的用法示例。
在下文中一共展示了Server.query_all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Server [as 别名]
# 或者: from models.Server import query_all [as 别名]
def get(self):
context = {'title': main_config.TITLE, 'description': main_config.DESCRIPTION}
user = self.user
if user:
if user.active:
servers = Server.query_all().fetch(100)
if servers and len(servers) == 1:
self.redirect(webapp2.uri_for('home', server_key=servers[0].url_key))
return
context = {
'servers': servers
}
self.render_template('main.html', context=context)
else:
form = UserEmailForm(obj=user)
context['form'] = form
self.render_template('main_inactive.html', context=context)
else:
self.render_template('main_unauth.html', context=context)
示例2: get
# 需要导入模块: from models import Server [as 别名]
# 或者: from models.Server import query_all [as 别名]
def get(self):
instance = Instance.singleton()
gce_server_running = False
servers = Server.query_all()
for server in servers:
server.update_status()
if server.is_gce:
if server.is_running and not server.idle and not server.has_open_play_session:
server.idle = datetime.datetime.utcnow()
server.put()
server.stop_if_idle()
if server.is_queued or server.is_running or server.is_unknown:
gce_server_running = True
if instance.idle:
instance.idle = None
instance.put()
if instance.is_running() and not gce_server_running and not instance.idle:
instance.idle = datetime.datetime.utcnow()
instance.put()
instance.stop_if_idle()
示例3: redirect_to_server
# 需要导入模块: from models import Server [as 别名]
# 或者: from models.Server import query_all [as 别名]
def redirect_to_server(self, route_name):
servers = Server.query_all().fetch(2)
if servers and len(servers) == 1:
self.redirect(webapp2.uri_for(route_name, server_key=servers[0].url_key))
else:
self.redirect(webapp2.uri_for('main'))
示例4: get
# 需要导入模块: from models import Server [as 别名]
# 或者: from models.Server import query_all [as 别名]
def get(self):
self.json_response(self.fetch_page(Server.query_all(), results_name='servers'), SERVER_STRATEGY)