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


Python turbogears.start_server函数代码示例

本文整理汇总了Python中turbogears.start_server函数的典型用法代码示例。如果您正苦于以下问题:Python start_server函数的具体用法?Python start_server怎么用?Python start_server使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: SvcDoRun

    def SvcDoRun(self):
        """ Called when the Windows Service runs. """

        self.ReportServiceStatus(win32service.SERVICE_START_PENDING)
        self.tg_init()
        self.ReportServiceStatus(win32service.SERVICE_RUNNING)
        turbogears.start_server(self.root())
开发者ID:TurboGears,项目名称:tgwebsite,代码行数:7,代码来源:service.py

示例2: start

def start():
    '''Start the CherryPy application server.'''
    turbogears.startup.call_on_startup.append(fedora.tg.utils.enable_csrf)
    setupdir = os.path.dirname(os.path.dirname(__file__))
    curdir = os.getcwd()

    # First look on the command line for a desired config file,
    # if it's not on the command line, then look for 'setup.py'
    # in the current directory. If there, load configuration
    # from a file called 'dev.cfg'. If it's not there, the project
    # is probably installed and we'll look first for a file called
    # 'prod.cfg' in the current directory and then for a default
    # config file called 'default.cfg' packaged in the egg.
    if len(sys.argv) > 1:
        configfile = sys.argv[1]
    elif os.path.exists(os.path.join(setupdir, 'setup.py')) \
            and os.path.exists(os.path.join(setupdir, 'dev.cfg')):
        configfile = os.path.join(setupdir, 'dev.cfg')
    elif os.path.exists(os.path.join(curdir, 'fas.cfg')):
        configfile = os.path.join(curdir, 'fas.cfg')
    elif os.path.exists(os.path.join('/etc/fas.cfg')):
        configfile = os.path.join('/etc/fas.cfg')
    else:
        try:
            configfile = pkg_resources.resource_filename(
              pkg_resources.Requirement.parse("fas"),
                "config/default.cfg")
        except pkg_resources.DistributionNotFound:
            raise ConfigurationError("Could not find default configuration.")

    turbogears.update_config(configfile=configfile,
        modulename="fas.config")

    from fas.controllers import Root
    turbogears.start_server(Root())
开发者ID:Affix,项目名称:fas,代码行数:35,代码来源:commands.py

示例3: start

def start():
    """Start the CherryPy application server."""

    setupdir = dirname(dirname(__file__))
    curdir = os.getcwd()

    # First look on the command line for a desired config file,
    # if it's not on the command line, then look for 'setup.py'
    # in the current directory. If there, load configuration
    # from a file called 'dev.cfg'. If it's not there, the project
    # is probably installed and we'll look first for a file called
    # 'prod.cfg' in the current directory and then for a default
    # config file called 'default.cfg' packaged in the egg.
    if len(sys.argv) > 1:
        configfile = sys.argv[1]
    elif exists(join(setupdir, "setup.py")):
        configfile = join(setupdir, "dev.cfg")
    elif exists(join(curdir, "prod.cfg")):
        configfile = join(curdir, "prod.cfg")
    else:
        try:
            configfile = pkg_resources.resource_filename(
              pkg_resources.Requirement.parse("gordonweb"),
                "config/default.cfg")
        except pkg_resources.DistributionNotFound:
            raise ConfigurationError("Could not find default configuration.")

    turbogears.update_config(configfile=configfile,
        modulename="gordonweb.config")

    from gordonweb.controllers import Root

    turbogears.start_server(Root())
开发者ID:bmcfee,项目名称:gordon,代码行数:33,代码来源:commands.py

示例4: main

def main():
    import sys
    import pkg_resources
    pkg_resources.require("TurboGears")
    
    # first look on the command line for a desired config file,
    # if it's not on the command line, then
    # look for setup.py in this directory. If it's not there, this script is
    # probably installed

    if len(sys.argv) > 1:
        configfile = sys.argv[1]
    elif exists(join(dirname(__file__), "setup.py")):
        configfile = "dev.cfg"
    else:
        configfile = "prod.cfg"

    lucene_lock = 'index/en/write.lock'
    if exists(lucene_lock):
        os.unlink(lucene_lock)
    # Patch before you start importing etc.
    import patches
    import patches.utils
    patches.utils.configfile = configfile
    updater = patches.Updater()
    updater.update()
    del updater
    del patches

    getoutput('./bin/kidc hubspace/templates')
    import monkeypatch
    import turbogears
    import cherrypy

    cherrypy.lowercase_api = True

    turbogears.update_config(configfile, modulename="hubspace.config")

    staic_target = turbogears.config.config.configs['global']['static_target_dir']
    static_link = turbogears.config.config.configs['/static']['static_filter.dir']

    if os.path.islink(static_link):
        os.remove(static_link)

    os.symlink(staic_target, static_link)
    print "Static link: %s -> %s" % (static_link, staic_target)

    
    def add_sync_filters():
        import hubspace.sync.core
        cherrypy.root._cp_filters.extend(hubspace.sync.core._cp_filters)

    import hubspace.search

    turbogears.startup.call_on_startup.append(add_sync_filters)
    turbogears.startup.call_on_shutdown.append(hubspace.search.stop)

    from hubspace.controllers import Root
    turbogears.start_server(Root())
开发者ID:mightymau,项目名称:hubspace,代码行数:59,代码来源:start_hubspace.py

示例5: start

def start():
    """Start the CherryPy application server."""
    if len(sys.argv) > 1:
        load_config(sys.argv[1])
    else:
        load_config()

    # If rlimit_as is defined in the config file then set the limit here.
    if turbogears.config.get('rlimit_as'):
        resource.setrlimit(resource.RLIMIT_AS, (turbogears.config.get('rlimit_as'),
                                                turbogears.config.get('rlimit_as')))

    from bkr.server.controllers import Root
    turbogears.start_server(Root())
开发者ID:sibiaoluo,项目名称:beaker,代码行数:14,代码来源:commands.py

示例6: start

def start():
    """Start the CherryPy application server."""
    
    _read_config(sys.argv[1:])
    
    from turboaffiliate.controllers import root
    return turbogears.start_server(root.Root())
开发者ID:SpectralAngel,项目名称:TurboAffiliate,代码行数:7,代码来源:command.py

示例7: start

def start():
    '''Start the CherryPy application server.'''
    if len(sys.argv) > 1:
        load_config(sys.argv[1])
    else:
        load_config()

    from fedora.tg.util import enable_csrf
    if turbogears.config.get('identity.provider') in ('sqlobjectcsrf', 'jsonfas2'):
        turbogears.startup.call_on_startup.append(enable_csrf)

    ## Schedule our periodic tasks
    from bodhi import jobs
    turbogears.startup.call_on_startup.append(jobs.schedule)

    from bodhi.controllers import Root
    turbogears.start_server(Root())
开发者ID:bitlord,项目名称:bodhi,代码行数:17,代码来源:commands.py

示例8: start

def start():
    """Start the CherryPy application server."""

    setupdir = dirname(dirname(__file__))
    curdir = getcwd()

    # First look on the command line for a desired config file,
    # if it's not on the command line, then look for 'setup.py'
    # in the current directory. If there, load configuration
    # from a file called 'dev.cfg'. If it's not there, the project
    # is probably installed and we'll look first for a file called
    # 'prod.cfg' in the current directory and then for a default
    # config file called 'default.cfg' packaged in the egg.
    if len(sys.argv) > 1:
        configfile = sys.argv[1]
    elif exists(join(setupdir, "setup.py")):
        configfile = join(setupdir, "dev.cfg")
    elif exists(join(curdir, "prod.cfg")):
        configfile = join(curdir, "prod.cfg")
    else:
        try:
            configfile = pkg_resources.resource_filename(
              pkg_resources.Requirement.parse("eCRM"),
                "config/default.cfg")
        except pkg_resources.DistributionNotFound:
            raise ConfigurationError("Could not find default configuration.")

    turbogears.update_config(configfile = configfile,
        modulename = "ecrm.config")

    #update the all vendor report
    #from ecrm import scheduler
    #remvoe the function by cl on 2010-09-30
 #   turbogears.startup.call_on_startup.append(scheduler.schedule)

    #gen the woven label report
    #from ecrm import autoOrder
    #turbogears.startup.call_on_startup.append(autoOrder.scheduleAM)
    #turbogears.startup.call_on_startup.append(autoOrder.schedulePM)

    from ecrm.controllers import Root




    turbogears.start_server(Root())
开发者ID:LamCiuLoeng,项目名称:bossini,代码行数:46,代码来源:commands.py

示例9: start

def start():
    """Start the CherryPy application server."""

    setupdir = dirname(dirname(__file__))
    curdir = getcwd()

    # First look on the command line for a desired config file,
    # if it's not on the command line then load pkgdb.cfg from the sysconfdir
    if len(sys.argv) > 1:
        configfile = sys.argv[1]
    else:
        configfile = pkgdata.get_filename('pkgdb.cfg', 'config')

    turbogears.update_config(configfile=configfile, modulename="pkgdb.config")

    from pkgdb.controllers import Root

    turbogears.start_server(Root())
开发者ID:fedora-infra,项目名称:packagedb,代码行数:18,代码来源:commands.py

示例10: start

def start():
    """Start the CherryPy application server."""
    global PRODUCTION_ENV
    setupdir = dirname(dirname(__file__))
    curdir = os.getcwd()

    # First look on the command line for a desired config file,
    # if it's not on the command line, then look for 'setup.py'
    # in the current directory. If there, load configuration
    # from a file called 'dev.cfg'. If it's not there, the project
    # is probably installed and we'll look first for a file called
    # 'prod.cfg' in the current directory and then for a default
    # config file called 'default.cfg' packaged in the egg.
    if exists("/etc/funcweb/prod.cfg"):
        #we work with production settings now !
        PRODUCTION_ENV = True
        configfile = "/etc/funcweb/prod.cfg"

    elif len(sys.argv) > 1:
        configfile = sys.argv[1]
    elif exists(join(setupdir, "setup.py")):
        configfile = join(setupdir, "dev.cfg")
    elif exists(join(curdir, "prod.cfg")):
        configfile = join(curdir, "prod.cfg")
    else:
        try:
            configfile = pkg_resources.resource_filename(
              pkg_resources.Requirement.parse("funcweb"),
                "config/default.cfg")
        except pkg_resources.DistributionNotFound:
            raise ConfigurationError("Could not find default configuration.")

    turbogears.update_config(configfile=configfile,
        modulename="funcweb.config")

    from funcweb.controllers import Root

    if PRODUCTION_ENV:
        utils.daemonize("/var/run/funcwebd.pid")
    #then start the server
    try:
        turbogears.start_server(Root())
    except Exception,e:
        print "Debug information from cherrypy server ...: ",e
开发者ID:caglar10ur,项目名称:func,代码行数:44,代码来源:commands.py

示例11: start

def start():
    cherrypy.lowercase_api = True
    # first look on the command line for a desired config file,
    # if it's not on the command line, then
    # look for setup.py in this directory. If it's not there, this script is
    # probably installed
    if len(sys.argv) > 1:
        turbogears.update_config(configfile=sys.argv[1], 
            modulename="mirrormanager.config")
    elif exists(join(os.getcwd(), "setup.py")):
        turbogears.update_config(configfile="dev.cfg",
            modulename="mirrormanager.config")
    else:
        turbogears.update_config(configfile="/etc/mirrormanager/prod.cfg",
            modulename="mirrormanager.config")

    from mirrormanager.controllers import Root

    turbogears.start_server(Root())
开发者ID:docent-net,项目名称:mirrormanager,代码行数:19,代码来源:commands.py

示例12: start

def start():
    """Start the CherryPy application server."""

    _read_config(sys.argv[1:])

    # Running the async task
    #from rmidb2 import async
    #turbogears.startup.call_on_startup.append(async.schedule)

    from rmidb2.controllers import Root
    return turbogears.start_server(Root())
开发者ID:jinmingda,项目名称:rmidb2,代码行数:11,代码来源:command.py

示例13: len

_cfg_filename = None
if len(sys.argv) > 1:
    _cfg_filename = sys.argv[1]

init(_cfg_filename)
update_config(configfile=config_filename(),modulename="hardware.config")


warnings.filterwarnings("ignore")
from hardware.controllers import Root
warnings.resetwarnings()

if config.get('server.environment') == 'production':
	pidfile='/var/run/smolt/smolt.pid'
else:
	pidfile='smolt.pid'

#--------------- write out the pid file -----------
import os
#pid = file('hardware.pid', 'w')
pid = file(pidfile, 'w')
pid.write(str(os.getpid()))
pid.close()
#--------------------------------------------------




start_server(Root())
开发者ID:MythTV,项目名称:smolt,代码行数:29,代码来源:start-hardware.py

示例14: start

def start():
    """Start the CherryPy application server."""

    _read_config(sys.argv[1:])
    from turborest_example.controllers import Root
    return turbogears.start_server(Root())
开发者ID:drocco007,项目名称:TurboRest,代码行数:6,代码来源:command.py

示例15: start

def start():
    """Start the CherryPy application server."""

    _read_config(sys.argv[1:])
    from sqlplayground.controllers import Root
    turbogears.start_server(Root())
开发者ID:mantour,项目名称:myrepo,代码行数:6,代码来源:command.py


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