当前位置: 首页>>代码示例>>Python>>正文


Python Server.servercreate方法代码示例

本文整理汇总了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))
开发者ID:cruor99,项目名称:networkcp_flask,代码行数:15,代码来源:views.py

示例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'])
开发者ID:TheMyst,项目名称:Steve,代码行数:17,代码来源:views.py

示例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)
开发者ID:cruor99,项目名称:networkcp_flask,代码行数:69,代码来源:views.py


注:本文中的server.Server.servercreate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。