本文整理汇总了Python中server.Server.servercreate方法的典型用法代码示例。如果您正苦于以下问题:Python Server.servercreate方法的具体用法?Python Server.servercreate怎么用?Python Server.servercreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类server.Server
的用法示例。
在下文中一共展示了Server.servercreate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: transfer_file
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import servercreate [as 别名]
def transfer_file(filename, user, serverip, port, ordertypeclean, stripped):
filename = filename
serv = Server()
serv.servercreate(str(serverip), str(user), str(port))
serv.sendfile(str(serverip), str(filename), str(user))
serv.unzip(str(serverip), str(user), str(filename))
serv.servercreate(str(serverip), str(user), str(port))
serv.editproperties(str(serverip), str(user), 'mscs-server-jar', str(stripped))
serv.editproperties(str(serverip), str(user), str('mscs-server-location'), str('/home/minecraft/worlds/'+user))
os.remove(os.path.join(os.path.join(app.config['UPLOAD_FOLDER'], filename)))
serv.editproperties(str(serverip), user, str('mscs-initial-memory'), str('128M'))
serv.editproperties(str(serverip), str(user), str('mscs-maximum-memory'), str(ordertypeclean+'M'))
serv.editproperties(str(serverip), str(user), str('server-port'), str(port))
示例2: manage
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import servercreate [as 别名]
def manage():
user = session['username']
serv = Server()
properties = serv.readproperties(user)
if request.method == 'POST':
server = request.form['server']
port = request.form['port']
serv = Server()
user = session['username']
serv.servercreate(server,user,port)
return render_template('manage.html',
user = session['username'],
properties=properties,
#serv = Server()
email = session['email'])
示例3: manage
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import servercreate [as 别名]
def manage():
user = session['username']
serv = Server()
form = PropertiesForm()
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
currsub = Subscription.query.filter_by(sub_id=orderline.sub_id).first()
ordertype = currsub.sub_type
ordertypeclean = ordertype[2:]
if request.method == 'POST':
if request.form['submit'] == 'Opprett properties':
serv.servercreate(str(serverip), user, str(port))
serv.editproperties(serverip, user, 'mscs-initial-memory', '128M')
serv.editproperties(serverip, user, 'mscs-maximum-memory', ordertypeclean+'M')
flash("Properties opprettet!")
return render_template('manage.html', user=session['username'], email=session['email'],
form=form, serverip=serverip, port=port)
if request.form['submit'] == 'Endre properties' and form.props.data != 'server-port' and \
form.props.data != 'mscs-initial-memory' and form.props.data != 'mscs-maximum-memory':
key = form.props.data
value = form.value.data
serv.editproperties(serverip, user, key, value)
return render_template('manage.html', user=session['username'], email=session['email'],
form=form, serverip=serverip, port=port)
if request.form['submit'] == 'Endre properties' and form.props.data == 'server-port':
flash(u'Du kan ikke endre din server port. Dette er for \xe5 hindre konflikt med andre servere!')
return render_template('manage.html', user=session['username'], email=session['email'],
form=form, serverip=serverip, port=port)
elif request.form['submit'] == 'Endre properties' and form.props.data == 'mscs-initial-memory':
flash(u'Du kan ikke endre minnest\xf8rrelsen p\xe5 serveren!')
return render_template('manage.html', user=session['username'], email=session['email'],
form=form, serverip=serverip, port=port)
elif request.form['submit'] == 'Endre properties' and form.props.data == 'mscs-maximum-memory':
flash(u'Du kan ikke endre minnest\xf8rrelsen p\xe5 serveren!')
return render_template('manage.html', user=session['username'], email=session['email'],
form=form, serverip=serverip, port=port)
if request.form['submit'] == 'Slett server innholdet':
serv.deleteserv(serverip, user)
return render_template('manage.html', user=session['username'], email=session['email'],
form=form, serverip=serverip, port=port)
if request.files is not None:
zipfile = request.files['file']
upload_file(zipfile)
filenameplaceholder = zipfile.filename
filenamestripped = filenameplaceholder.strip('.zip') + '.jar'
servername = filenamestripped
thr = Thread(target=transfer_file, args=(zipfile.filename, user, serverip, port, ordertypeclean, servername))
if filenameplaceholder != "":
#filenamestripped = filenameplaceholder.strip('.zip') + '.jar'
#servername = filenamestripped
thr.start()
flash(u'Filopplastingen har startet, du vil f\xe5 en beskjed p\xe5 e-post n\xe5r den er ferdig!')
#transfer_file(zipfile.filename, user, serverip, port, ordertypeclean, servername)
#flash('You did it!')
else:
flash('Velg en fil!')
if request.form['submit'] == 'Gjenopprett sikkerhetskopi':
serv.restorebackup(serverip, user)
flash('Serveren er gjenopprettet!')
if request.form['submit'] == 'Sikkerhetskopier serveren':
serv.backupserv(serverip, user)
flash('Serveren er sikkerhetskopiert!')
return render_template('manage.html', user=session['username'], email=session['email'],
form=form, serverip=serverip, port=port)