本文整理汇总了Python中web.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: webproxy
def webproxy():
import web, pprint
urls = ('/(.*)', 'main')
class main:
def GET(self, url):
pprint.pprint(pvs(url, **web.input()))
web.run(urls, locals())
开发者ID:acgourley,项目名称:watchdog,代码行数:8,代码来源:pvsapi.py
示例2: startServer
def startServer():
web.internalerror = web.debugerror
if USE_SYSTRAY and WIN32:
print "Quit via systray icon"
elif not USE_SYSTRAY and WIN32:
print "Control-C then page reload to quit"
else: print "Control-C to quit"
web.run(urls, web.reloader)
开发者ID:BackupTheBerlios,项目名称:sharetunes-svn,代码行数:8,代码来源:sharetunes.py
示例3: run
def run():
""" Run the web UI """
# UI runs on port 5940
sys.argv = [sys.argv[0]]
sys.argv.append("5940")
print "Starting HarvestMan Web UI at port 5940..."
web.internalerror = web.debugerror
web.run(urls, globals(), web.reloader)
开发者ID:pombredanne,项目名称:harvestman-crawler-2,代码行数:9,代码来源:gui.py
示例4: loop_father
def loop_father():
try:
from web import run
run()
except ImportError:
while True:
if input("cmd: ") == "q!":
break
_term()
开发者ID:lwzm,项目名称:ep,代码行数:9,代码来源:udp.py
示例5: main
def main():
controller = RoombaWebController()
controller.ResetRoomba()
"""
controller.StartWebcam()
controller.StartMicrophone()
"""
web.webapi.internalerror = web.debugerror
urls = ('/(.*)', 'controller')
web.run(urls, locals())
开发者ID:saasmath,项目名称:pyrobotXO1,代码行数:10,代码来源:web_ui.py
示例6: main
def main():
#if __name__=="__main__":
#sys.argv.append("5940")
#Because web.py expects the port to be passed on argv[1] I will replace it here. The original argv[1] is '--genconf'
sys.argv[1]='5940'
print "Starting web.py at port 5940..."
web.internalerror = web.debugerror
# Start timer thread to run after 5 seconds
print 'Waiting for page to load in browser...'
threading.Timer(5.0, open_page).start()
web.run(urls, globals(), web.reloader)
开发者ID:pombredanne,项目名称:harvestman-crawler-2,代码行数:11,代码来源:genconfig.py
示例7: start_server
def start_server():
web.webapi.internalerror = web.debugerror
print "start server....."
if config.listen_port is not 0:
if len(sys.argv) > 1:
sys.argv[1] = str(config.listen_port)
else:
sys.argv.append(str(config.listen_port))
#config default database conncection that mananged by web
#web.config.db_parameters = config.db_config['default']
import logging
logging.basicConfig(level=logging.DEBUG)
web.run(urls, globals(), web.reloader)
开发者ID:dalinhuang,项目名称:demodemo,代码行数:16,代码来源:server.py
示例8: run
def run(tagcloud):
global tagclouder
tagclouder = tagcloud
middleware = []
if not PROD:
middleware.append(web.reloader)
web.webapi.internalerror = web.debugerror
#web.httpserver.runsimple = web.httpserver.runbasic # did this solve my problems?
import sys
if len(sys.argv) > 1:
sys.argv[1] = IP_PORT
else:
sys.argv.append(IP_PORT)
web.run(urls, globals(), *middleware) #, web.profiler)
开发者ID:chuang1990,项目名称:context-agent,代码行数:18,代码来源:webserver.py
示例9: startClicked
def startClicked(self):
ip = str(self.ipEdit.text())
port = str(self.portEdit.text())
global sync_cards
global sync_days
global sync_paths
global sync_names
try:
sync_cards = int(self.scards.text())
except:
sync_cards = 1
try:
sync_days = int(self.sdays.text())
except:
sync_days = 1
if sync_cards < 1:
sync_cards = 1
elif sync_cards > 1000:
sync_cards = 1000
if sync_days < 1:
sync_days = 1
elif sync_days > 4:
sync_days = 4
sync_paths = [d[1] for d in reversed(self.decks) if (d[0].checkState())]
sync_names = [d[2] for d in reversed(self.decks) if (d[0].checkState())]
self.config['ianki_ip'] = ip
self.config['ianki_port'] = port
self.config['ianki_sync_cards'] = sync_cards
self.config['ianki_sync_days'] = sync_days
self.config['ianki_decks'] = sync_paths
#if deck.syncName in self.config['ianki_decks']:
self.scards.setText(_(str(sync_cards)))
self.sdays.setText(_(str(sync_days)))
web.wsgi.connectIP = ip+':'+port
global urls, glob
self.logText.append('Starting server at ' + web.wsgi.connectIP +'.')
self.server = web.run(urls, glob);
if self.server:
self.startButton.setEnabled(False)
self.stopButton.setEnabled(True)
self.settingsBox.setEnabled(False)
self.logText.append('Server started.')
else:
self.logText.append('Failed to start server.')
开发者ID:flerda,项目名称:ianki,代码行数:50,代码来源:ui.py
示例10: FlofFacade
# in old Python versions:
# if seen.has_key(marker)
# but in new ones:
if marker in seen: continue
seen[marker] = 1
result.append(item)
return result
#########################################################################
render = web.template.render('templates/', cache='DEV' not in os.environ)
template.Template.globals['len'] = len
template.Template.globals['version'] = '7'
flof = FlofFacade()
mapService = MapService('osm-iphone-big', '../osm/mapnik/osm-shirley.xml', \
'static/images/watermark.png', '/tmp/tilecache')
mapServiceMini = MapService('osm-iphone-thumb', \
'../osm/mapnik/osm-shirley.xml', \
'static/images/watermarkmini.png', '/tmp/tilecache')
if __name__ == "__main__":
if 'DEV' in os.environ:
middleware = [web.reloader]
else:
middleware = []
web.run(urls, globals(), *middleware)
开发者ID:jcodagnone,项目名称:iphone.flof.com.ar,代码行数:30,代码来源:webapp.py
示例11: __init__
print 'setting up start up middleware'
#
## MIDDLEWARE
#
class start_mw:
def __init__(self,app):
web.load()
self.load()
self.app = app
def __call__(self, e, o):
return self.app(e, o)
def load(self):
glbl.load()
#
## RUN
#
web.webapi.internalerror = web.debugerror
if __name__ == "__main__":
print 'setting up db'
web.config.db_parameters = dict(dbn='mysql', user=db_params.user, pw=db_params.password, db=db_params.database)
print 'setting up loadhooks'
web._loadhooks['aliased_url'] = aliased_url
#mw = [start_mw, web.profiler]
mw = [start_mw]
print 'starting server'
web.run(urls, globals(), *mw)
开发者ID:keizo,项目名称:kulu,代码行数:29,代码来源:index.py
示例12: GET
import web
urls = ('/(.*)', 'hello')
class hello:
def GET(self, name):
i = web.input(times=1)
if not name: name = 'world'
for c in xrange(int(i.times)): print 'Hello,', name+'!'
if __name__ == "__main__": web.run(urls, globals())
开发者ID:loonghu,项目名称:LovelyPython,代码行数:8,代码来源:tryweb.py
示例13: Entry
entry = Entry(owner=user, url=form['url'].value)
entry.put()
else:
raise web.Error(400, 'no image/url included')
@check_user
def handle_request(path):
if path == '/':
print template.render('templates/frontpage.tmpl', {})
elif path == '/cycle':
print template.render('templates/image.tmpl',
{ 'json': current_json(),
'query': os.environ.get('QUERY_STRING', ''),
'cycle': 1 })
elif path == '/new':
return new(path)
elif path.startswith('/image/'):
id = int(path[len('/image/'):])
entry = Entry.get_by_id(id)
if not entry:
raise web.Error(404)
print entry.image
return {}
elif path == '/json':
print current_json()
return {'Content-Type': 'application/json'}
else:
raise web.Error(404)
web.run(handle_request)
开发者ID:evmar,项目名称:onscreen,代码行数:30,代码来源:onscreen.py
示例14: GET
ct = " - ".join(curr())
print render.base(track = ct)
print render.bottom
class prev:
def GET(self):
ct = " - ".join(curr())
print render.base(track = ct)
print "<b>Previous track requested</b>"
print render.bottom
interface.previous_track()
class next:
def GET(self):
ct = " - ".join(curr())
print render.base(track = ct)
print "<b>Next track requested</b>"
print render.bottom
interface.next_track()
class playpause:
def GET(self):
ct = " - ".join(curr())
print render.base(track = ct)
print "<b>Toggled play/pause</b>"
print render.bottom
interface.playpause()
web.webapi.internalerror = web.debugerror
if __name__ == '__main__': web.run(urls, globals())
开发者ID:anarchivist,项目名称:pytunes,代码行数:30,代码来源:pytunes.py
示例15: render_cached_feed
events = [e for e in db.get_events(limit='100', order='time_taken desc', where ="taken_from= '%s'" % (source))]
render_cached_feed(events, feed_type)
class feed:
def GET(self, format_type='atom'):
events = [e for e in db.get_events(limit='100', order='time_taken desc', where='duplicateof is null')]
web.debug(type(events[0].name))
render_cached_feed(events, format_type)
def render_cached_feed(events, format_type='atom'):
last_modif_time = events[0].time_taken
web.debug(last_modif_time)
#http conditional get
if not config.http_conditional_get or web.modified(last_modif_time):
web.lastmodified(last_modif_time)
web.header("Content-Type", "application/atom+xml")
web.debug(len(events))
print render.events_atom_feed(config, last_modif_time, events)
def runfcgi_apache(func):
web.wsgi.runfcgi(func, None)
if __name__ == "__main__":
import os
if "LOCAL" not in os.environ:
#web.wsgi.runwsgi = runfcgi_apache
pass
web.run(urls, globals(), *config.middleware)
#application = web.wsgifunc(web.webpyfunc(urls, globals()))
开发者ID:antoine,项目名称:metagenda,代码行数:30,代码来源:main.py
示例16: GET
def GET(self):
print '<html><body>'
print '<form name="blah" method="post">'
print '<input type="checkbox" name="boo" value="hoo" />'
print '<input type="checkbox" name="boo" value="poo" />'
print '<input type="checkbox" name="noo" checked="false" />'
print '<input type="checkbox" name="noo" checked="checked" />'
print myform.render()
print '<input type="submit" />'
print '</form></body></html>'
def POST(self):
print web.input(boo=[], noo=[])
#
## MIDDLEWARE FACTORIES
#
def session_mw(app):
sessionStore = DatabaseSessionStore(timeout=5)
return SessionMiddleware(sessionStore, app)
#web.webapi.internalerror = web.debugerror
if __name__ == "__main__":
web.config.db_parameters = dict(dbn='mysql', user=db_params.user, pw=db_params.password, db=db_params.database)
#production:
#web.run(urls, globals(), *[session_mw])
#development laptop:
web.internalerror = web.debugerror
web.run(urls, globals(), *[web.reloader])
开发者ID:keizo,项目名称:kulu,代码行数:30,代码来源:exp.py
示例17: GET
out.append(c.get_response().data)
return "".join(out)
else:
return None
class index:
def GET(self):
print render.index()
class related:
def GET(self, oclcnum):
numcite = CitationRequest(wskey=WSKEY, \
rec_num=oclcnum).get_response().data
print render.related(oclcnum=oclcnum, numcite=numcite,
response=get_related(oclcnum))
def POST(self):
oclcnum = web.input().oclcnum
numcite = CitationRequest(wskey=WSKEY, \
rec_num=oclcnum).get_response().data
print render.related(oclcnum=oclcnum, numcite=numcite,
response=get_related(oclcnum))
web.webapi.internalerror = web.debugerror
if __name__ == '__main__':
web.run(urls, globals())
开发者ID:Web5design,项目名称:worldcat,代码行数:30,代码来源:wcrelated.py
示例18:
import web
if __name__ == "__main__":
web.run()
开发者ID:lucaslrolim,项目名称:DeuRuim,代码行数:4,代码来源:run.py
示例19: runserver
def runserver():
web.webapi.internalerror = web.debugerror
web.run(urls, globals(), web.reloader)
开发者ID:stucchio,项目名称:DJ-Pirate,代码行数:3,代码来源:__init__.py
示例20: GET_Index
import pyvm_extra
pyvm_extra.thread_status ()
except:
pass
def GET_Index (self):
web.header ('Content-Type', 'text/html')
print "<html><body><ul>"
for i in sorted (PAGES.keys ()):
print '<li><a href=/%s.html>%s</a>' %(i, i)
if not PAGES [i].text:
print "(empty)"
if PAGES [i].modified ():
print "(modified<blink>!</blink>)"
print "</ul></body></html>"
tothewiki=r"""<html><head>
<meta http-equiv=refresh content="2;url=%s">
</head><body>redirecting to %s...
let's hope it works!</body></html>
"""
#
# __main__ -- this is an application
#
port = int (sys.argv [1])
ADDR = "http://"+HOST+":"+str(port)+"/"
file (REDIRECT_DIR+REDIRECT_FILE, 'w').write (tothewiki % (ADDR, ADDR))
web.run (urls)
开发者ID:funny-falcon,项目名称:pyvm,代码行数:30,代码来源:site.py
注:本文中的web.run函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论