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


Python _evwsgi.start函数代码示例

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


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

示例1: start

def start():
	evwsgi.start('0.0.0.0', '8080') 
	evwsgi.set_base_module(base)

	def proxy(baseurl):
		def f(environ, start_response):
			try:
				import urllib2
				resp = urllib2.urlopen(baseurl + environ["PATH_INFO"] + ("?" + environ["QUERY_STRING"] if environ["QUERY_STRING"] != "" else ""))
				if resp.code == 200:
					start_response('200 OK', [('Content-Type', resp.info().gettype())])
					return [resp.read()]
			except:
				start_response('403 ERROR', [('Content-Type', 'text/plain')])
				return ['Error loading request.']
		return f

	evwsgi.wsgi_cb(('/boundaries/', proxy("http://gis.govtrack.us/boundaries/")))
	evwsgi.wsgi_cb(('/map/tiles/', proxy("http://gis.govtrack.us/map/tiles/")))
	evwsgi.wsgi_cb(('/static/rep_photos/', proxy("http://www.govtrack.us/data/photos/")))
	
	staticfile = views.Staticfile('static', maxage=2629000)
	evwsgi.wsgi_cb(('/static', staticfile))

	staticfile = views.Staticfile('your_new_district.html', maxage=2629000)
	evwsgi.wsgi_cb(('/', staticfile))

	evwsgi.set_debug(0)	   
	evwsgi.run()
开发者ID:JoshData,项目名称:my2012district,代码行数:29,代码来源:httpd.py

示例2: start

def start():
    evwsgi.start(
        os.getenv('FAVIEW_IP', '0.0.0.0'),
        os.getenv('FAVIEW_PORT', '8080'),
    )
    evwsgi.set_base_module(base)

    for local_path, real_path in MEDIA_PREFIX.iteritems():
        media_dir = ServeStatic(
            settings.MEDIA_ROOT + local_path,
            real_path,
            maxage = 2629000,
        )
        evwsgi.wsgi_cb((
            settings.MEDIA_URL + local_path,
            media_dir,
        ))

    def generic(environ, start_response):
        res = django_handler.handler(environ, start_response)
        return [res]

    evwsgi.wsgi_cb(('', generic))
    evwsgi.set_debug(0)
    evwsgi.run()
开发者ID:boothale,项目名称:faview,代码行数:25,代码来源:runserver.py

示例3: start

def start():
    if socket_server:
        evwsgi.start("\0/org/fapws3/server", "unix")
    else:
        evwsgi.start("0.0.0.0", "8080")
    evwsgi.set_base_module(mybase)
    
 
    evwsgi.wsgi_cb(("/env", env))
    evwsgi.wsgi_cb(("/helloclass", helloclass("!!!")))
    evwsgi.wsgi_cb(("/hello", hello))
    evwsgi.wsgi_cb(("/tuplehello", tuplehello))
    evwsgi.wsgi_cb(("/iterhello", iteration))
    evwsgi.wsgi_cb(("/longzipped", staticlongzipped))
    evwsgi.wsgi_cb(("/long", staticlong))
    evwsgi.wsgi_cb(("/elong", embedlong))
    evwsgi.wsgi_cb(("/short", staticshort))
    staticform=views.Staticfile("test.html")
    evwsgi.wsgi_cb(("/staticform", staticform))
    evwsgi.wsgi_cb(("/testpost", testpost))
    evwsgi.wsgi_cb(("/badscript", badscript))
    evwsgi.wsgi_cb(("/returnnone", returnnone))
    evwsgi.wsgi_cb(("/returnnull", returnnull))
    evwsgi.wsgi_cb(("/returniternull", returniternull))

    evwsgi.set_debug(0)    
    evwsgi.run()
开发者ID:Amli,项目名称:fapws3,代码行数:27,代码来源:server.py

示例4: start

def start():
    evwsgi.start("0.0.0.0", "8080")
    evwsgi.set_base_module(fapws.base)
    evwsgi.wsgi_cb(("", generic))
    evwsgi.set_debug(0)
    print "libev ABI version:%i.%i" % evwsgi.libev_version()
    evwsgi.run()
开发者ID:tetratec,项目名称:fapws3,代码行数:7,代码来源:run.py

示例5: start

def start():
	evwsgi.start('0.0.0.0', '80') 
	evwsgi.set_base_module(base)
	
	#TODO - should read /etc/cobbler/settings and provide
	#any global parameters
	#settings = open(fileloc, 'r')
	#parse the file
	#settings.close()
	
	def sysname(environ, start_response):
		#you might need to strip fully qualified domain
		#if you don't have them in your cobbler install
		hostname = str(environ['PATH_INFO']).split('.')[0]

		fileloc = '/var/lib/cobbler/config/systems.d/' \
			+ hostname + '.json'
		out = {}
		try:	
			sys = open(fileloc, 'r')
			system = json.load(sys)
			sys.close()
			mp = system['mgmt_parameters']
			km = system['ks_meta']
			mp.update(km)
			out['parameters'] = mp
			out['classes'] = system['mgmt_classes']
			out['classes'] = system['mgmt_classes']
		except IOError, e:
			out['parameters'] = []
			out['classes'] = []
			
		outprint = yaml.safe_dump(out, default_flow_style=True)
		start_response('200 OK', [('Content-Type','text/html')])
		return[outprint]
开发者ID:jameslegg,项目名称:cobbler-crack,代码行数:35,代码来源:cobbler-crack.py

示例6: start

def start():
    evwsgi.start("0.0.0.0", "8080")
    evwsgi.set_base_module(base)
    
    def hello(environ, start_response):
        start_response('200 OK', [('Content-Type','text/html')])
        return ["hello world!!"]

    @log.Log()
    def staticlong(environ, start_response):
        try:
            f=open("long.txt", "rb")
        except:
            f=["Page not found"]
        start_response('200 OK', [('Content-Type','text/html')])
        return f
    def embedlong(environ, start_response):
        try:
            c=open("long.txt", "rb").read()
        except:
            c=["Page not found"]
        start_response('200 OK', [('Content-Type','text/html')])
        return base.split_len(c,32768)
    def staticshort(environ, start_response):
        f=open("short.txt", "rb")
        start_response('200 OK', [('Content-Type','text/html')])
        return f
    def testpost(environ, start_response):
        print environ
        print "INPUT DATA",environ["wsgi.input"].getvalue()
        return ["OK. params are:%s" % (environ["fapws.params"])]

    @log.Log()
    @zip.Gzip()    
    def staticlongzipped(environ, start_response):
        try:
            f=open("long.txt", "rb")
        except:
            f=["Page not found"]
        start_response('200 OK', [('Content-Type','text/html')])
        return f
    def iteration(environ, start_response):
        start_response('200 OK', [('Content-Type','text/plain')])
        yield "hello"
        yield " "
        yield "worlds!!"

    
    evwsgi.wsgi_cb(("/hello", hello))
    evwsgi.wsgi_cb(("/iterhello", iteration))
    evwsgi.wsgi_cb(("/longzipped", staticlongzipped))
    evwsgi.wsgi_cb(("/long", staticlong))
    evwsgi.wsgi_cb(("/elong", embedlong))
    evwsgi.wsgi_cb(("/short", staticshort))
    staticform=views.Staticfile("test.html")
    evwsgi.wsgi_cb(("/staticform", staticform))
    evwsgi.wsgi_cb(("/testpost", testpost))

    evwsgi.set_debug(0)    
    evwsgi.run()
开发者ID:fdr,项目名称:fapws3,代码行数:60,代码来源:hello_world.py

示例7: fork_main

def fork_main(child_no=1):
	print 'parent:', os.getpid()

	def create_shared():
		return {'name': 'realtime'}

	channels = create_shared()
	posh.share(channels)

	evwsgi.start('0.0.0.0', '8080')
	evwsgi.set_base_module(base)

	child = list()
	for i in range(child_no):
		child.append(posh.forkcall(start, i, channels))

	def on_interrupt(signum, frame):
		print 'terminating %i children' % len(child)
		for pid in child:
			print 'kill(%i)' % pid
			os.kill(pid, signal.SIGINT)
	signal.signal(signal.SIGINT, on_interrupt)

	print 'forked %i childs' % len(child)
	posh.waitall()
开发者ID:caruccio,项目名称:fapws3,代码行数:25,代码来源:push.py

示例8: run_server

def run_server(app, host, port):
    from fapws import base
    from fapws._evwsgi import start, set_base_module, wsgi_cb, run
    start(host, str(port))
    set_base_module(base)
    wsgi_cb(('/', app))
    run()
开发者ID:jonashaag,项目名称:WSGITest,代码行数:7,代码来源:config.py

示例9: start

def start():
	evwsgi.start(db_link_host, str(db_link_port)) 
	evwsgi.set_base_module(base)

	evwsgi.wsgi_cb(('', application))

	evwsgi.set_debug(0)	   
	evwsgi.run()
开发者ID:ricardoosorio,项目名称:a2z-gene,代码行数:8,代码来源:teste.py

示例10: run

 def run(self):
     from blog import Blog
     self.update()
     self.blog = Blog(self.config)
     evwsgi.start(self.config['host'], self.config['port'])
     evwsgi.set_base_module(base)
     self.loadWebPath()
     evwsgi.run()
开发者ID:rossdylan,项目名称:GIBSY,代码行数:8,代码来源:__init__.py

示例11: run_with_fapws3

def run_with_fapws3(config):
    import fapws._evwsgi as evwsgi
    from fapws import base, config

    evwsgi.start(config['host'], config['port'])
    evwsgi.set_base_module(base)
    evwsgi.wsgi_cb(('', config['request_handler']))
    evwsgi.set_debug(0)
    evwsgi.run()
开发者ID:gpelipas,项目名称:adobopy,代码行数:9,代码来源:web.py

示例12: start_server

def start_server():
    evwsgi.start("0.0.0.0", "5747")
    evwsgi.set_base_module(fapws.base)
    stats_app = AnyStat()
    evwsgi.wsgi_cb(("/stats/", stats_app))
    commit = lambda: stats_app.cache.commit()
    evwsgi.add_timer(10, commit)
    #evwsgi.set_debug(1)
    evwsgi.run()
开发者ID:donspaulding,项目名称:anystat,代码行数:9,代码来源:anystat_fapws3.py

示例13: start

    def start(self):
        self.silence_spurious_logging()

        evwsgi.start(self.interface, self.port)
        evwsgi.set_base_module(base)
        evwsgi.wsgi_cb(("/", wsgi_dispatcher))
        evwsgi.set_debug(0)
        self.logger.info('%r running...' % (self,))
        evwsgi.run()
开发者ID:yaniv-aknin,项目名称:labour,代码行数:9,代码来源:server_fapws3.py

示例14: start

def start():
    evwsgi.start(HOST, str(PORT))
    evwsgi.set_base_module(base)

    evwsgi.wsgi_cb(('/static', views.Staticfile(STATIC_PATH)))
    evwsgi.wsgi_cb(('/broadcast', broadcast))

    evwsgi.set_debug(0)
    evwsgi.run()
开发者ID:marconi,项目名称:igor,代码行数:9,代码来源:serve.py

示例15: start

def start(host, port):
	"""Fapws3 WSGI application"""

	evwsgi.start(host or '127.0.0.1', port or '8000')
	evwsgi.set_base_module(fapws.base)

	evwsgi.wsgi_cb(("/api", web.application.init_memcached()))

	evwsgi.set_debug(0)
	evwsgi.run()
开发者ID:HengeSense,项目名称:littlebrother,代码行数:10,代码来源:wsgi_fapws3.py


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