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


Python gluon.main方法代码示例

本文整理汇总了Python中gluon.main方法的典型用法代码示例。如果您正苦于以下问题:Python gluon.main方法的具体用法?Python gluon.main怎么用?Python gluon.main使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gluon的用法示例。


在下文中一共展示了gluon.main方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import main [as 别名]
def run(servername, ip, port, softcron=True, logging=False, profiler=None,
        options=None):
    if servername == 'gevent':
        from gevent import monkey
        monkey.patch_all()
    elif servername == 'eventlet':
        import eventlet
        eventlet.monkey_patch()

    import gluon.main

    if logging:
        application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
                                            logfilename='httpserver.log',
                                            profiler_dir=profiler)
    else:
        application = gluon.main.wsgibase
    if softcron:
        from gluon.settings import global_settings
        global_settings.web2py_crontype = 'soft'
    getattr(Servers, servername)(application, (ip, int(port)), options=options) 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:23,代码来源:anyserver.py

示例2: wsgiapp

# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import main [as 别名]
def wsgiapp(env, res):
    """Return the wsgiapp"""
    env['PATH_INFO'] = env['PATH_INFO'].decode('latin1').encode('utf8')

    #when using the blobstore image uploader GAE dev SDK passes these as unicode
    # they should be regular strings as they are parts of URLs
    env['wsgi.url_scheme'] = str(env['wsgi.url_scheme'])
    env['QUERY_STRING'] = str(env['QUERY_STRING'])
    env['SERVER_NAME'] = str(env['SERVER_NAME'])

    #this deals with a problem where GAE development server seems to forget
    # the path between requests
    if global_settings.web2py_runtime == 'gae:development':
        gluon.admin.create_missing_folders()

    web2py_path = global_settings.applications_parent  # backward compatibility

    return gluon.main.wsgibase(env, res) 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:20,代码来源:gaehandler.py

示例3: run

# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import main [as 别名]
def run(options):
    import gluon.main
    if options.password != '<recycle>':
        gluon.main.save_password(options.password, int(options.port))
    if options.logging:
        application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
                                            logfilename='httpserver.log',
                                            profiler_dir=profiler)
    else:
        application = gluon.main.wsgibase
    address = (options.ip, int(options.port))
    workers = options.workers
    spawn = workers and Pool(int(options.workers)) or 'default'
    ssl_args = dict()
    if options.ssl_private_key:
        ssl_args['keyfile'] = options.ssl_private_key
    if options.ssl_certificate:
        ssl_args['certfile'] = options.ssl_certificate
    server = pywsgi.WSGIServer(
                    address, application,
                    spawn=spawn, log=None,
                    **ssl_args
                    )
    server.serve_forever() 
开发者ID:rekall-innovations,项目名称:rekall-agent-server,代码行数:26,代码来源:web2py_on_gevent.py

示例4: stop_trace

# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import main [as 别名]
def stop_trace():
    """stop waiting for the debugger (called atexit)"""
    # this should prevent communicate is wait forever a command result
    # and the main thread has finished
    logger.info("DEBUG: stop_trace!")
    pipe_out.write("debug finished!")
    pipe_out.write(None)
    #pipe_out.flush() 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:10,代码来源:debug.py

示例5: main

# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import main [as 别名]
def main():
    """Run the wsgi app"""
    run_wsgi_app(wsgiapp) 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:5,代码来源:gaehandler.py

示例6: stop_trace

# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import main [as 别名]
def stop_trace():
    "stop waiting for the debugger (called atexit)"
    # this should prevent communicate is wait forever a command result
    # and the main thread has finished
    logger.info("DEBUG: stop_trace!")
    pipe_out.write("debug finished!")
    pipe_out.write(None)
    #pipe_out.flush() 
开发者ID:StuffShare,项目名称:StuffShare,代码行数:10,代码来源:debug.py

示例7: main

# 需要导入模块: import gluon [as 别名]
# 或者: from gluon import main [as 别名]
def main():
    usage = "python anyserver.py -s tornado -i 127.0.0.1 -p 8000 -l -P"
    try:
        version = open('VERSION','r')
    except IOError:
        version = ''
    parser = optparse.OptionParser(usage, None, optparse.Option, version)
    parser.add_option('-l',
                      '--logging',
                      action='store_true',
                      default=False,
                      dest='logging',
                      help='log into httpserver.log')
    parser.add_option('-P',
                      '--profiler',
                      default=False,
                      dest='profiler_dir',
                      help='profiler dir')
    servers = ', '.join(x for x in dir(Servers) if not x[0] == '_')
    parser.add_option('-s',
                      '--server',
                      default='rocket',
                      dest='server',
                      help='server name (%s)' % servers)
    parser.add_option('-i',
                      '--ip',
                      default='127.0.0.1',
                      dest='ip',
                      help='ip address')
    parser.add_option('-p',
                      '--port',
                      default='8000',
                      dest='port',
                      help='port number')
    parser.add_option('-w',
                      '--workers',
                      default=None,
                      dest='workers',
                      help='number of workers number')
    (options, args) = parser.parse_args()
    print 'starting %s on %s:%s...' % (
        options.server, options.ip, options.port)
    run(options.server, options.ip, options.port,
        logging=options.logging, profiler=options.profiler_dir,
        options=options) 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:47,代码来源:anyserver.py


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