本文整理汇总了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())
示例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())
示例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())
示例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())
示例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())
示例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())
示例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())
示例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())
示例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())
示例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
示例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())
示例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())
示例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())
示例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())
示例15: start
def start():
"""Start the CherryPy application server."""
_read_config(sys.argv[1:])
from sqlplayground.controllers import Root
turbogears.start_server(Root())