def application(environ, start_response): ''' url conf ''' cherrypy.tree.mount(Test(), '/test') cherrypy.tree.mount(Admin(), '/admin') cherrypy.tree.mount(AdminIndex(), '/admin/admin') cherrypy.tree.mount(AdminArticle(), '/admin/article') cherrypy.tree.mount(Clevel(), '/clevel') cherrypy.tree.mount(Front(), '/', config={ '/static': { 'tools.staticdir.on': True, 'tools.staticdir.dir': static_path } }) cherrypy.config.update({ 'tools.sessions.on': True, 'tools.sessions.timeout': 3000 }) cherrypy.server.max_request_body_size = 0 cherrypy.server.socket_timeout = 60 return cherrypy.tree(environ, start_response)
def application(environ, start_response): #return cherrypy.tree(environ, start_response) try: cherrypy.tree.mount(Controller(), config="/home/options/scheduler/cherrypy.config") return cherrypy.tree(environ, start_response) except Exception as err: return str(err)
def application(environ, start_response): syslog.openlog('passive_dns_wsgi_server', logoption=syslog.LOG_PID) myprefix = os.path.dirname(os.path.abspath(__file__)) wsgi_config = myprefix + '/wsgi_api.ini' if not os.path.exists(wsgi_config): wsgi_config = '/etc/passivedns_wsgi_api.ini' if not os.path.exists(wsgi_config): log('Fatal error: config file not found!', priority=syslog.LOG_ERR) sys.exit(1) #################### # read DB config config = configparser.ConfigParser() config.read(wsgi_config) db_user = config.get('dbro', 'user').strip('\'').strip('"') db_pass = config.get('dbro', 'pass').strip('\'').strip('"') db_host = config.get('dbro', 'host').strip('\'').strip('"') db_db = config.get('dbro', 'db').strip('\'').strip('"') db_url = 'postgresql+psycopg2://{0}:{1}@{2}/{3}'.format(db_user, db_pass, db_host, db_db) #################### db = init_db(db_url) cherrypy.config['tools.encode.on'] = True cherrypy.config['tools.encode.encoding'] = 'utf-8' cherrypy.config.update(config=wsgi_config) cherrypy.tree.mount(Manage(db), '/', config=wsgi_config) return cherrypy.tree(environ, start_response)
def application(environ, start_response): conf = {} cherrypy.config.update({ 'server.socket_port': 8080 }) app = cherrypy.tree.mount(Poor(), '/', config=conf) return cherrypy.tree(environ, start_response)
def application(environ, start_response): conf = {} cherrypy.config.update({ 'server.socket_port': 8101 }) app = cherrypy.tree.mount(Survey(), '/') return cherrypy.tree(environ, start_response)
def application(environ, start_response): cherrypy.config.update(environ['configuration']) cherrypy.serving.request.wsgi_environ = environ cherrypy.tree.mount(cherrypy.Application(maki.ROOT, None), '', environ['configuration']) maki.db.load_engine(maki.CONFIG('sqlalchemy')) return cherrypy.tree(environ, start_response)
def application(environ, start_response): syslog.openlog('passive_dns_wsgi_server', logoption=syslog.LOG_PID) myprefix = os.path.dirname(os.path.abspath(__file__)) wsgi_config = myprefix + '/wsgi_api.ini' if not os.path.exists(wsgi_config): wsgi_config = '/etc/passivedns_wsgi_api.ini' if not os.path.exists(wsgi_config): log('Fatal error: config file not found!', priority=syslog.LOG_ERR) sys.exit(1) #################### # read DB config config = configparser.ConfigParser() config.read(wsgi_config) db_user = config.get('dbro', 'user').strip('\'').strip('"') db_pass = config.get('dbro', 'pass').strip('\'').strip('"') db_host = config.get('dbro', 'host').strip('\'').strip('"') db_db = config.get('dbro', 'db').strip('\'').strip('"') db_url = 'postgresql+psycopg2://{0}:{1}@{2}/{3}'.format( db_user, db_pass, db_host, db_db) #################### db = init_db(db_url) cherrypy.config['tools.encode.on'] = True cherrypy.config['tools.encode.encoding'] = 'utf-8' cherrypy.config.update(config=wsgi_config) cherrypy.tree.mount(Manage(db), '/', config=wsgi_config) return cherrypy.tree(environ, start_response)
def application(environ, start_response): cherrypy.tree.mount(Gallery('/storage/accalia/images/'), '/gallery/', None) cherrypy.tree.mount(Comic(), '/comic/', None) cherrypy.config["tools.encode.on"] = True cherrypy.config["tools.encode.encoding"] = "utf-8" cherrypy.config["tools.decode.on"] = True cherrypy.config["tools.decode.encoding"] = "utf-8" return cherrypy.tree(environ, start_response)
def application(environ, start_response): """ Run as WSGI application """ cherrypy.config.update(environ['configuration']) cherrypy.tree.mount(FakeMyMedia('/home/traherom/downloads/converted/', '/home/traherom/downloads/', environ['SERVER_NAME'], environ['SERVER_PORT']), script_name=environ['SCRIPT_NAME'], config=environ['configuration']) return cherrypy.tree(environ, start_response)
def application(environ, start_response): """ running behind Apache as a WSGI app is not currently supported, but I'm keeping this code here because I hope for it to be supported some day. we'll need to set up an AMQP task queue and related magic for that to happen, though. """ cherrypy.config.update({'environment': 'embedded'}) setup = parse_opts(argv=['-C', environ['config']]) root = Core(setup, start_fam_thread=True) cherrypy.tree.mount(root) return cherrypy.tree(environ, start_response)
def application(environ, start_response): cherrypy.config.update(default_conf) cherrypy.config.update({'environment': 'embedded'}) if 'configuration' in environ: cherrypy.config.update(environ['configuration']) cherrypy.tree.mount(rootV1, cherrypy.config.get('virtual_root', '').rstrip('/') + '/api/v1', app_config) return cherrypy.tree(environ, start_response)
def application(environ, start_response): """ Handler for WSGI appications. Assume that it does not run threaded.""" dba = URL('postgresql', username=config.defaults.DB_USER, database=config.defaults.DB_NAME, password=config.defaults.DB_PASSWORD) cherrypy.thread_data.conn = create_engine(dba, echo=False).connect() setup_site(environ['WMT_CONFIG'], script_name=environ['SCRIPT_NAME'], debug=False) cherrypy.config.update({'log.wsgi' : True, 'log.screen' : False}) globals()['application'] = cherrypy.tree return cherrypy.tree(environ, start_response)
def application(environ, start_response): load_config() init_db() db_check() reload_template() cherrypy.config.update({ 'server.socket_port': SERVER_PORT, }) cherrypy.tree.mount(PdfServer(), '/%s/' % SERVER_PATH) return cherrypy.tree(environ, start_response)
def application(environ, start_response): cherrypy.config.update({ #'environment': 'production', 'log.error_file': os.path.join(rootpath, 'log', 'site.log'), # ... }) if 'appcontext' in environ: appcontext = environ["appcontext"] cherrypy.log("got env var appcontext") cherrypy.log("APPCONTEXT has value %s" % appcontext) cherrypy.tree.mount(Root(), script_name="/%s" % appcontext, config=routesConf) return cherrypy.tree(environ, start_response)
def application(environ, start_response): """ Run as WSGI application. WARNING: It appears that the app gets reloaded for each request under Apache. Process forking may be the cause. This prevents the app from actually working. However, fixing this would be entirely possible CherryPy sessions were used and the password files were decrypted each time. The recommended setup is to instead run it behind mod_rewrite """ cherrypy.config.update(environ['configuration']) cherrypy.tree.mount(MainPage(cherrypy.config['pwdb.connection']), script_name=environ['SCRIPT_NAME'], config=environ['configuration']) return cherrypy.tree(environ, start_response)
def application(environ, start_response): conf = { '/'+PATH_IMAGES: {'tools.staticdir.on': True, 'tools.staticdir.dir': SERVER_IMAGES}, '/css': {'tools.staticdir.on': True, 'tools.staticdir.dir': SERVER_CSS}, } cherrypy.config.update({ 'tools.sessions.on': True, 'tools.sessions.storage_type': 'file', 'tools.sessions.storage_path': SERVER_SESSIONS, 'server.socket_port': SERVER_PORT }) app = cherrypy.tree.mount(ArchiveServer(), '/', config=conf) return cherrypy.tree(environ, start_response)
def application(environ, start_response): print "app" cherrypy.config.update( { "tools.sessions.on": True, "tools.sessions.storage_type": "ram", "tools.sessions.timeout": 60, "tools.CORS.on": True, "environment": "embedded", } ) cherrypy.tree.mount(Root(), script_name="wacky-tracky API", config=None) return cherrypy.tree(environ, start_response)
def application(environ, start_response): global loaded import cherrypy if not loaded: loaded = True modname = 'cherrypy.test.' + environ['testmod'] mod = __import__(modname, globals(), locals(), ['']) mod.setup_server() cherrypy.config.update({'log.error_file': os.path.join(curdir, 'test.error.log'), 'log.access_file': os.path.join(curdir, 'test.access.log'), 'environment': 'test_suite', 'engine.SIGHUP': None, 'engine.SIGTERM': None}) return cherrypy.tree(environ, start_response)
def application(environ, start_response): # # Setup logging. # Do only once, else we might end up with multiple loggers that all do # the same thing. # global logger if not logger: logger = logging.getLogger() logger.setLevel(logging.DEBUG) h = logging.FileHandler("/tmp/rpi_web_wsgi.log") h.setFormatter(logging.Formatter("%(asctime)s %(thread)d : %(message)s")) logger.addHandler(h) logging.debug("Log handler added to root logger.") cherrypy.tree.mount(None, script_name="/wsgi/", config=conf) return cherrypy.tree(environ, start_response)
def application(environ, start_response): cherrypy.server.max_request_body_size = 0 cherrypy.server.socket_timeout = 60 restful_conf = { '/': { 'request.dispatch':cherrypy.dispatch.MethodDispatcher(), #'tools.sessions.on':True, #'tools.sessions.storage_type':"file", #'tools.sessions.storage_path':"sessions", #'tools.sessions.timeout': 60 }, } cherrypy.tree.mount(files(), '/files', config=restful_conf) #cherrypy.tree.mount(upload(), '/', None) cherrypy.tree.mount(status(), '/status', config=restful_conf) return cherrypy.tree(environ, start_response)
def application(environ, start_response): import cherrypy global loaded if not loaded: loaded = True modname = "cherrypy.test." + environ['testmod'] mod = __import__(modname, globals(), locals(), ['']) mod.setup_server() cherrypy.config.update({ "log.error_file": os.path.join(curdir, "test.error.log"), "log.access_file": os.path.join(curdir, "test.access.log"), "environment": "test_suite", "engine.SIGHUP": None, "engine.SIGTERM": None, }) return cherrypy.tree(environ, start_response)
def application(environ, start_response): print "application" config_fp = os.path.join(here, 'config.py') config = eval(open(config_fp, 'rb').read()) cp_conf = { 'global': { 'server.socket_port': config.get('socket_port', 8000), 'server.max_request_body_size': config.get('max_request_body_size', 1048576), 'environment': config.get('environment', 'development'), }, } cherrypy.tree.mount(URLShortener(config), "/", cp_conf) return cherrypy.tree(environ, start_response)
def application(environ, start_response): conf = { '/' + PATH_IMAGES: { 'tools.staticdir.on': True, 'tools.staticdir.dir': SERVER_IMAGES }, '/css': { 'tools.staticdir.on': True, 'tools.staticdir.dir': SERVER_CSS }, } cherrypy.config.update({ 'tools.sessions.on': True, 'tools.sessions.storage_type': 'file', 'tools.sessions.storage_path': SERVER_SESSIONS, 'server.socket_port': SERVER_PORT }) app = cherrypy.tree.mount(ArchiveServer(), '/', config=conf) return cherrypy.tree(environ, start_response)
def application(environ, start_response): ''' url conf ''' cherrypy.tree.mount(Test(), '/test') cherrypy.tree.mount(Admin(), '/admin') cherrypy.tree.mount(AdminIndex(), '/admin/admin') cherrypy.tree.mount(AdminArticle(), '/admin/article') cherrypy.tree.mount(Clevel(),'/clevel') cherrypy.tree.mount(Front(), '/', config={'/static': {'tools.staticdir.on': True, 'tools.staticdir.dir': static_path}}) cherrypy.config.update({'tools.sessions.on': True, 'tools.sessions.timeout': 3000}) cherrypy.server.max_request_body_size = 0 cherrypy.server.socket_timeout = 60 return cherrypy.tree(environ, start_response)
def application(environ=None, start_response=None, configuration=configure(), initialize=util.InitializationOption.NoAction): """Webserver setup code environ: passed from WSGI (if not present, use cherrypy's built-in webserver) start_response: passed from WSGI (if not present, use cherrypy's built-in webserver) configuration: a configuration object, normally from the configure() function initialize: controls db initialization. See util.InitializationOption If 'environ' and 'start_response' parameters are passed, assume WSGI; otherwise, start cherrypy's built-in webserver. """ log.setLevel(configuration['loglevel']) for handler in configuration['loghandlers']: log.addHandler(handler) log.debug("BibleMunger logging configured") lockableconn = util.LockableSqliteConnection(configuration['dburi']) log.debug("Using SQLite URI: {}".format(configuration['dburi'])) bib = bible.Bible(lockableconn, configuration['tablenames']['bible']) bib.initialize_table(initialize) if not bib.hasverses: log.debug("Bible doesn't have its database initialized; initializing...") bib.addversesfromxml(os.path.abspath(configuration['bible'])) favorites = SavedSearches(lockableconn, configuration['tablenames']['favorites']) favorites.initialize_table(initialize) for fave in configuration['favorites']: favorites.add(fave['search'], fave['replace']) global versionfile vers = MungerVersion(versionfile) server = Munger(bib, favorites, vers) cherrypy.tree.mount(server, '/', { '/': { 'tools.mako.directories': os.path.join(scriptdir, 'temple'), 'tools.mako.debug': configuration['debug'], 'tools.staticdir.root': scriptdir}, '/static': { 'tools.staticdir.on': True, 'tools.staticdir.dir': 'static'}, "/favicon.ico": { "tools.staticfile.on": True, "tools.staticfile.filename": os.path.join(scriptdir, 'static', 'favicon.ico')}}) mode = 'wsgi' if environ and start_response else 'cherrypy' if mode == 'wsgi': log.debug("Returning BibleMunger as WSGI application") sys.stdout = sys.stderr cherrypy.config.update({'environment': 'embedded'}) return cherrypy.tree(environ, start_response) elif mode == 'cherrypy': log.debug("Starting BibleMunger's CherryPy HTTP server") cherrypy.config.update({ 'server.socket_port': configuration['port'], 'server.socket_host': configuration['server']}) cherrypy.engine.signals.subscribe() cherrypy.engine.start() cherrypy.engine.block()
def application( environ, start_response ): cherrypy.config.update( {} ) cherrypy.tree.mount( formular.Form(), script_name="/", config=config ) return cherrypy.tree( environ, start_response )
def application(environ, start_response): """passes application to wsgi""" return cherrypy.tree(environ, start_response)
def application(env, start_response): """ uWSGI entry point """ # Instantiate and configure flamebelly server flamebelly = Flamebelly() flamebelly.load_modules(config.items('flamebelly_modules')) return cherrypy.tree(env, start_response)
def application(environ, start_response): return cherrypy.tree(environ, start_response)
def application(environ, start_response): # Used with a WSGI server cherrypy.tree.mount(ExampleController(), '/api/example', config=CP_CONFIG) return cherrypy.tree(environ, start_response)
def erase_script_name(environ, start_response): environ['SCRIPT_NAME'] = '' return cherrypy.tree(environ, start_response)
def application(environ, start_response): """ Run the web application with UWSGI """ run_server() return cherrypy.tree(environ, start_response)
def application(env, start_response): cfg = {'/': {'foo': 'bar'}} app = tree.mount(Root(), script_name='/', config=cfg) return tree(env, start_response)
def application(environ, start_response): cherrypy.config.update(server_conf) cherrypy.tree.mount(RootController(), "/", app_conf) return cherrypy.tree(environ, start_response)
def application(environ, start_response): # WSGI launch: root = Root() root.persona = Persona() cherrypy.tree.mount(root, '/', None) return cherrypy.tree(environ, start_response)
ip2as_bin_dat = '' if ip2as_ is None: if not ip2as_bin_dat == '': ip2as_ = IP2AS(ip2as_bin_dat, use_msgpack=True) else: ip2as_ = IP2AS(ip2as_dat) cherrypy.tools.ip2as = IP2ASTool() cherrypy.config['tools.encode.on'] = True cherrypy.config['tools.encode.encoding'] = 'utf-8' cherrypy.config.update(config=wsgi_config) cherrypy.tree.mount(Manage(), '/', config=wsgi_config) return cherrypy.tree(environ, start_response) if __name__ == '__main__': syslog.openlog('ip2as_wsgi_server', logoption=syslog.LOG_PID) myprefix = os.path.dirname(os.path.abspath(__file__)) wsgi_config = myprefix + '/wsgi_api.ini' if not os.path.exists(wsgi_config): wsgi_config = '/etc/ip2as_wsgi_api.ini' if not os.path.exists(wsgi_config): log('Fatal error: config file not found!', priority=syslog.LOG_ERR) sys.exit(1) config = configparser.ConfigParser() config.read(wsgi_config)
def application(environ, start_response): cherrypy.tree.mount(ZotDroid(), '/', None) return cherrypy.tree(environ, start_response)
def wsgi_app(environ, start_response): root, _, conf = opts_tuple or bootstrap_app() cherrypy.config.update({"environment": "embedded"}) cherrypy.tree.mount(root, "/", conf) return cherrypy.tree(environ, start_response)
def application(environ, start_response): print "app()" cherrypy.tree.mount(Root()) return cherrypy.tree(environ, start_response);
def application(environ, start_response): cherrypy.config.update({}) cherrypy.tree.mount(formular.Form(), script_name="/", config=config) return cherrypy.tree(environ, start_response)
def application(environ, start_response): cherrypy.tree.mount(root, '/') return cherrypy.tree(environ, start_response)
def application(environ, start_response): cherrypy.config.update({}) cherrypy.tree.mount(PlotThatLutWeb(), script_name="/", config=config) return cherrypy.tree(environ, start_response)
def application(environ, start_response): cherrypy.tree.mount(main.Root(homeLocation), script_name='/', config=main.rootConfig(homeLocation)) return cherrypy.tree(environ, start_response)
def wsgi_app(environ, start_response): root, _, conf = opts_tuple or bootstrap_app() cherrypy.config.update({'environment': 'embedded'}) cherrypy.tree.mount(root, '/', conf) return cherrypy.tree(environ, start_response)
def wsgi(env, start_response, script_name=''): global virtual_dir virtual_dir = script_name configure_routes(script_name) return cherrypy.tree(env, start_response)
def application(environ, start_response): cherrypy.tree.mount(CSV2RDFApp(), "/", "csv2rdf/server/config") cherrypy.tree.mount(CSV2RDFRefineAPI(), "/api/", "csv2rdf/server/config") return cherrypy.tree(environ, start_response)
def application(environ, start_response): cherrypy.tree.mount(server(), "/", None) return cherrypy.tree(environ, start_response)
def application(environ, start_response): load_config() conf = {} cherrypy.config.update({'server.socket_port': 8084}) app = cherrypy.tree.mount(Folders(), '/', config=conf) return cherrypy.tree(environ, start_response)
def application(environ, start_response): initialize() return cherrypy.tree(environ, start_response)
def wsgi(env, start_response, script_name=''): configure_routes(script_name) return cherrypy.tree(env, start_response)
def application(env, start_response): start_response('200 OK', [('Content-Type', 'text/html')]) cherrypy.tree.mount(CultMap(), "/cultmap", "cultmap/app_cultmap.conf") # 'app_cultmap.conf') # What's the difference between graft and mount? cherrypy.tree.mount(Search(), "/search", "search/app_search.conf") return cherrypy.tree(env, start_response)