本文整理汇总了Python中server.Server.servercommand方法的典型用法代码示例。如果您正苦于以下问题:Python Server.servercommand方法的具体用法?Python Server.servercommand怎么用?Python Server.servercommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类server.Server
的用法示例。
在下文中一共展示了Server.servercommand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mcserver
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import servercommand [as 别名]
def mcserver():
form = CommandForm()
user = session['username']
serv = Server()
orderline = Order.query.filter_by(cust_id=session['userid']).first()
dbport = Port.query.filter_by(port_id=orderline.port_id).first()
server = Serverreserve.query.filter_by(server_id=dbport.server_id).first()
serverip = server.server_ip
port = dbport.port_no
if request.method == 'POST':
if request.form['submit'] == 'Start serveren':
ttt = Thread(target=serv.serverstart, args=(serverip, user))
ttt.start()
serv.serverstart(serverip, user)
if request.form['submit'] == 'Stopp serveren':
serv.serverstop(str(serverip), user)
if request.form['submit'] == 'Send kommandoen':
command = form.command.data
serv.servercommand(str(serverip), user, command)
return render_template('server.html', form=form)
示例2: server
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import servercommand [as 别名]
def server():
user = session['username']
serv = Server()
# output = threading.Timer(3, serveroutput, args=user).start()
output = serv.readconsole(user)
print output
if request.method == 'POST':
if request.form['submit'] == 'Start':
serv.serverstart(user)
#output = serv.serverread(user)
return render_template('server.html')
if request.form['submit'] == 'Stop':
serv.serverstop(user)
if request.form['submit'] == 'stopall':
serv.serverstop("")
if request.form['submit'] == 'startall':
serv.serverstart("")
if request.form['submit'] == 'Send':
command = request.form['command']
serv.servercommand(user,command)
return render_template('server.html', output=output)