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())
def tg_init(self): try: from radspeed.MSWordReportController import MSWordReportController, Root Root.MSWORD = MSWordReportController() from radspeed import mysession cherrypy.lib.sessions.MysqlSession = mysession.RadspeedSQLStorage # Set environment to production to disable auto-reload. cherrypy.config.update({ 'global': { 'server.environment': 'production', 'server.socket_port': self.port, 'engine.autoreload_on': False, 'i18n.get_locale': lambda: locale }, }) self.root = Root start_server(Root()) except Exception, e: print "<<start-mswordserver -- tg_init>> Exception : " + str(e) log.critical( "<<start-mswordserver -- tg_init>> Error occured while initializing the ms word server : %s. Shutting down the service.", e) # Shall stop service win32serviceutil.StopService('InstaMSWebService')
def start(): '''Start the CherryPy application server.''' turbogears.startup.call_on_startup.append(fedora.tg.tg1utils.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())
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())
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())
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())
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())
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 exists("/etc/funcweb/prod.cfg"): print "I use the production ito the etc !" configfile = "/etc/funcweb/prod.cfg" elif len(sys.argv) > 1: print "We got something from the sys" configfile = sys.argv[1] elif exists(join(setupdir, "setup.py")): print "I use the dev one into the dev dir" configfile = join(setupdir, "dev.cfg") elif exists(join(curdir, "prod.cfg")): print "I use the prod one into the cur dir" configfile = join(curdir, "prod.cfg") else: try: configfile = pkg_resources.resource_filename( pkg_resources.Requirement.parse("funcweb"), "config/default.cfg") print "That is another default conf" 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 exists("/etc/funcweb/prod.cfg"): futils.daemonize("/var/run/funcwebd.pid") #then start the server try: turbogears.start_server(Root()) except Exception, e: print "Exception occured :", e sys.exit(1)
def start(): """Start the CherryPy application server.""" _read_config(sys.argv[1:]) from turboaffiliate.controllers import root return turbogears.start_server(root.Root())
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())
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())
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())
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
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())
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())
# Add WidgetLibs directory to the python path: sys.path.append("../..") # Add Trunk to the python path: sys.path.append("../../..") # 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: update_config(configfile=sys.argv[1], modulename="testserver.config") elif exists(join(dirname(__file__), "setup.py")): update_config(configfile="dev.cfg", modulename="testserver.config") else: update_config(configfile="prod.cfg", modulename="testserver.config") config.update(dict(package="testserver")) from testserver.controllers import Root print "WebBrick panel widgets test server" print "" print "*** NOTE ***" print "File WebBrickGateway/panels/tests/TestServer/testserver/config/app.cfg must" print "be edited so that definition 'webbrickRootDirectory' reflects the location" print "of files to be served on this system" print "" start_server(Root()) # End.
_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())
def start(): """Start the CherryPy application server.""" _read_config(sys.argv[1:]) from protdigest1.controllers import Root turbogears.start_server(Root())
def start(): """Start the CherryPy application server.""" _read_config(sys.argv[1:]) from turborest_example.controllers import Root return turbogears.start_server(Root())
def start(): """Start the CherryPy application server.""" _read_config(sys.argv[1:]) from sqlplayground.controllers import Root turbogears.start_server(Root())
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
#!C:\Python24\python.exe import pkg_resources pkg_resources.require("TurboGears") import turbogears import cherrypy 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="mesa.config") elif exists(join(dirname(__file__), "setup.py")): turbogears.update_config(configfile="dev.cfg", modulename="mesa.config") else: turbogears.update_config(configfile="prod.cfg", modulename="mesa.config") from mesa.controllers import Root turbogears.start_server(Root())
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"))
def start(): """Start the CherryPy application server.""" boot(use_argv=True) from buzzbot.controllers import Root turbogears.start_server(Root())