• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python turbogears.start_server函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: len

cherrypy.lowercase_api = True

from os.path import *
import sys

# 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="scoop.config")
elif exists(join(dirname(__file__), "setup.py")):
    turbogears.update_config(configfile="dev.cfg",
        modulename="scoop.config")
else:
    turbogears.update_config(configfile="prod.cfg",
        modulename="scoop.config")

from scoop.controllers import *

if True:
    turbogears.start_server(Root())
else:
    import thread
    th = thread.start_new_thread(
        turbogears.start_server,
        (Root(),))
    print th

开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:29,代码来源:start-scoop.py


示例17: build_controllers

from os.path import *
import sys

from tasty.controllers import build_controllers

root = build_controllers()

# 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 __name__ == "__main__":
    if len(sys.argv) > 1:
        turbogears.update_config(configfile=sys.argv[1], 
            modulename="tasty.config")
    elif exists(join(dirname(__file__), "setup.py")):
        turbogears.update_config(configfile="dev.cfg",
            modulename="tasty.config")
    else:
        turbogears.update_config(configfile="prod.cfg",
            modulename="tasty.config")
    turbogears.start_server(root)


def mp_setup():
    '''
    mpcp.py looks for this method for CherryPy configs but our *.cfg files handle that.
    '''
    cherrypy.config.update(file=join(dirname(__file__),"prod.cfg"))
开发者ID:ccnmtl,项目名称:tasty,代码行数:29,代码来源:start-tasty.py


示例18: start

def start():
    """Start the CherryPy application server."""
    boot(use_argv=True)
    from buzzbot.controllers import Root
    turbogears.start_server(Root())
开发者ID:pbarton666,项目名称:buzz_bot,代码行数:5,代码来源:commands.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python turbogears.update_config函数代码示例发布时间:2022-05-27
下一篇:
Python turbogears.redirect函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap