本文整理汇总了Python中tiddlyweb.web.serve.load_app函数的典型用法代码示例。如果您正苦于以下问题:Python load_app函数的具体用法?Python load_app怎么用?Python load_app使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_app函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: wserver
def wserver(args):
"""Run a server that reloads code automagically."""
poll_interval = config.get('reloader_interval', 1)
extra_files = config.get('reloader_extra_files', [])
pid = _start_server()
if pid:
# we must call load_app() to process system_plugins and handlers
# and get them into sys.modules, which is what the Monitor
# watches.
load_app()
signal.signal(signal.SIGCHLD, sig_child_handler(pid))
mon = ForkingMonitor(poll_interval=poll_interval, extra_files=extra_files)
mon.pid = pid
mon.periodic_reload()
开发者ID:FND,项目名称:tiddlywiki-svn-mirror,代码行数:14,代码来源:wserver.py
示例2: setup_module
def setup_module(module):
try:
shutil.rmtree('indexdir')
shutil.rmtree('store')
except:
pass
app = load_app()
def app_fn(): return app
requests_intercept.install()
wsgi_intercept.add_wsgi_intercept('tankt.peermore.com', 8080, app_fn)
store = get_store(config)
test_bag1 = Bag('newtank')
try:
store.delete(test_bag1)
except StoreError:
pass
test_bag1.policy.accept = ['NONE']
store.put(test_bag1)
module.environ = {'tiddlyweb.store': store, 'tiddlyweb.config': config}
module.store = store
module.cookie, module.csrf = establish_user_auth(config, store,
'tankt.peermore.com:8080', 'tester')
开发者ID:BillSeitz,项目名称:tank,代码行数:27,代码来源:test_closet.py
示例3: start
def start():
dirname = os.path.dirname(__file__)
if sys.path[0] != dirname:
sys.path.insert(0, dirname)
from tiddlyweb.web import serve
app = serve.load_app(app_prefix='', dirname=dirname)
return app
开发者ID:andrey013,项目名称:tiddlyweb,代码行数:7,代码来源:wsgiapp.py
示例4: make_test_env
def make_test_env(module):
global SESSION_COUNT
try:
shutil.rmtree('test_instance')
except:
pass
os.system('mysqladmin -f drop tiddlyspacetest create tiddlyspacetest')
if SESSION_COUNT > 1:
del sys.modules['tiddlywebplugins.tiddlyspace.store']
del sys.modules['tiddlywebplugins.mysql2']
del sys.modules['tiddlywebplugins.sqlalchemy2']
import tiddlywebplugins.tiddlyspace.store
import tiddlywebplugins.mysql2
import tiddlywebplugins.sqlalchemy2
clear_hooks(HOOKS)
SESSION_COUNT += 1
db_config = init_config['server_store'][1]['db_config']
db_config = db_config.replace('///tiddlyspace?', '///tiddlyspacetest?')
init_config['server_store'][1]['db_config'] = db_config
init_config['log_level'] = 'DEBUG'
if sys.path[0] != os.getcwd():
sys.path.insert(0, os.getcwd())
spawn('test_instance', init_config, instance_module)
os.symlink('../tiddlywebplugins/templates', 'templates')
from tiddlyweb.web import serve
module.store = get_store(config)
app = serve.load_app()
def app_fn():
return app
module.app_fn = app_fn
开发者ID:Erls-Corporation,项目名称:tiddlyspace,代码行数:35,代码来源:fixtures.py
示例5: setup_module
def setup_module(module):
# cleanup
try:
shutil.rmtree('store')
except OSError:
pass
# establish web server
app = load_app()
def app_fn():
return app
httplib2_intercept.install()
wsgi_intercept.add_wsgi_intercept('our_test_domain', 8001, app_fn)
# establish store
store = Store(config['server_store'][0], config['server_store'][1],
environ={'tiddlyweb.config': config})
# make some stuff
bag = Bag('place')
store.put(bag)
for i in range(1, 10):
tiddler = Tiddler('tiddler%s' % i, 'place')
tiddler.text = 'hi%s'
store.put(tiddler)
module.http = httplib2.Http()
开发者ID:tiddlyweb,项目名称:tiddlywebplugins.etagcache,代码行数:27,代码来源:test_stress.py
示例6: initialize_app
def initialize_app():
app = load_app()
def app_fn():
return app
httplib2_intercept.install()
wsgi_intercept.add_wsgi_intercept('our_test_domain', 8001, app_fn)
开发者ID:chancejiang,项目名称:tiddlyweb,代码行数:7,代码来源:fixtures.py
示例7: setup_module
def setup_module(module):
try:
shutil.rmtree('indexdir')
shutil.rmtree('store')
except:
pass
app = load_app()
def app_fn(): return app
httplib2_intercept.install()
wsgi_intercept.add_wsgi_intercept('tankt.peermore.com', 8080, app_fn)
store = get_store(config)
test_bag = Bag('editable')
try:
store.delete(test_bag)
except StoreError:
pass
store.put(test_bag)
module.environ = {'tiddlyweb.store': store, 'tiddlyweb.config': config}
module.store = store
module.http = httplib2.Http()
module.csrf = None
开发者ID:BillSeitz,项目名称:tank,代码行数:27,代码来源:test_edit.py
示例8: initialize_app
def initialize_app():
app = load_app()
def app_fn():
return app
httplib2_intercept.install()
wsgi_intercept.add_wsgi_intercept('0.0.0.0', 8080, app_fn)
开发者ID:tiddlyweb,项目名称:tiddlywebplugins.mapuser,代码行数:8,代码来源:fixtures.py
示例9: establish
def establish():
"""
Set up the global app.
"""
from tiddlyweb.config import config
global app
app = App(load_app(), config)
return app
开发者ID:cdent,项目名称:tiddlybeaker,代码行数:9,代码来源:__init__.py
示例10: make_test_env
def make_test_env(module, hsearch=False):
"""
If hsearch is False, don't bother updating the whoosh index
for this test instance. We do this by removing the store HOOK
used by whoosh.
"""
global SESSION_COUNT
# bump up a level if we're already in the test instance
if os.getcwd().endswith('test_instance'):
os.chdir('..')
try:
shutil.rmtree('test_instance')
except:
pass
os.system('echo "drop database if exists tiddlyspacetest; create database tiddlyspacetest character set = utf8mb4 collate = utf8mb4_bin;" | mysql')
if SESSION_COUNT > 1:
del sys.modules['tiddlywebplugins.tiddlyspace.store']
del sys.modules['tiddlywebplugins.mysql3']
del sys.modules['tiddlywebplugins.sqlalchemy3']
import tiddlywebplugins.tiddlyspace.store
import tiddlywebplugins.mysql3
import tiddlywebplugins.sqlalchemy3
tiddlywebplugins.mysql3.Session.remove()
clear_hooks(HOOKS)
SESSION_COUNT += 1
db_config = init_config['server_store'][1]['db_config']
db_config = db_config.replace('///tiddlyspace?', '///tiddlyspacetest?')
init_config['server_store'][1]['db_config'] = db_config
init_config['log_level'] = 'DEBUG'
if sys.path[0] != os.getcwd():
sys.path.insert(0, os.getcwd())
spawn('test_instance', init_config, instance_module)
os.chdir('test_instance')
os.symlink('../tiddlywebplugins/templates', 'templates')
os.symlink('../tiddlywebplugins', 'tiddlywebplugins')
from tiddlyweb.web import serve
module.store = get_store(init_config)
app = serve.load_app()
if not hsearch:
from tiddlywebplugins.whoosher import _tiddler_change_handler
try:
HOOKS['tiddler']['put'].remove(_tiddler_change_handler)
HOOKS['tiddler']['delete'].remove(_tiddler_change_handler)
except ValueError:
pass
def app_fn():
return app
module.app_fn = app_fn
开发者ID:Alanchi,项目名称:tiddlyspace,代码行数:56,代码来源:fixtures.py
示例11: start
def start():
# What is our hostname
hostname = config['hostname']
# What is path to us (the base url)
port = 80
if ':' in hostname:
hostname, port = hostname.split(':')
app = serve.load_app(hostname, port, config['urls_map'])
return app
开发者ID:FND,项目名称:tiddlywiki-svn-mirror,代码行数:11,代码来源:tiddlyguv_modpython.py
示例12: initialize_app
def initialize_app(cfg):
config.update(cfg) # XXX: side-effecty
config['server_host'] = {
'scheme': 'http',
'host': 'example.org',
'port': '8001',
}
httplib2_intercept.install()
wsgi_intercept.add_wsgi_intercept('example.org', 8001, lambda: load_app())
return config
开发者ID:FND,项目名称:tiddlywebplugins.gitstore,代码行数:12,代码来源:__init__.py
示例13: _initialize_app
def _initialize_app(cfg):
config.update(cfg) # XXX: side-effecty
config['server_host'] = {
'scheme': 'http',
'host': 'example.org',
'port': '8001',
}
config['system_plugins'].append('tiddlywebplugins.tagdex')
httplib2_intercept.install()
wsgi_intercept.add_wsgi_intercept('example.org', 8001, lambda: load_app())
return config
开发者ID:FND,项目名称:tiddlywebplugins.tagdex,代码行数:13,代码来源:test_web.py
示例14: setup_module
def setup_module(module):
app = load_app()
def app_fn():
return app
httplib2_intercept.install()
wsgi_intercept.add_wsgi_intercept('0.0.0.0', 8080, app_fn)
module.store = get_store(config)
module.http = httplib2.Http()
try:
shutil.rmtree('store')
except:
pass # we don't care
开发者ID:cdent,项目名称:tiddlywebplugins.patch,代码行数:15,代码来源:test_web_patch.py
示例15: make_test_env
def make_test_env(module, hsearch=False):
"""
If hsearch is False, don't bother updating the whoosh index
for this test instance. We do this by removing the store HOOK
used by whoosh.
"""
global SESSION_COUNT
try:
shutil.rmtree('test_instance')
except:
pass
os.system('mysqladmin -f drop tiddlyspacetest create tiddlyspacetest')
if SESSION_COUNT > 1:
del sys.modules['tiddlywebplugins.tiddlyspace.store']
del sys.modules['tiddlywebplugins.mysql3']
del sys.modules['tiddlywebplugins.sqlalchemy3']
import tiddlywebplugins.tiddlyspace.store
import tiddlywebplugins.mysql3
import tiddlywebplugins.sqlalchemy3
clear_hooks(HOOKS)
SESSION_COUNT += 1
db_config = init_config['server_store'][1]['db_config']
db_config = db_config.replace('///tiddlyspace?', '///tiddlyspacetest?')
init_config['server_store'][1]['db_config'] = db_config
init_config['log_level'] = 'DEBUG'
if sys.path[0] != os.getcwd():
sys.path.insert(0, os.getcwd())
spawn('test_instance', init_config, instance_module)
os.symlink('tiddlywebplugins/templates', 'test_instance/templates')
from tiddlyweb.web import serve
module.store = get_store(config)
app = serve.load_app()
if not hsearch:
from tiddlywebplugins.whoosher import _tiddler_change_handler
try:
HOOKS['tiddler']['put'].remove(_tiddler_change_handler)
HOOKS['tiddler']['delete'].remove(_tiddler_change_handler)
except ValueError:
pass
def app_fn():
return app
module.app_fn = app_fn
开发者ID:moveek,项目名称:tiddlyspace,代码行数:48,代码来源:fixtures.py
示例16: start_server
def start_server(config):
from cheroot.wsgi import Server as WSGIServer
hostname = config['server_host']['host']
port = int(config['server_host']['port'])
scheme = config['server_host']['scheme']
app = load_app()
server = WSGIServer((hostname, port), app)
try:
LOGGER.debug('starting Cheroot at %s://%s:%s',
scheme, hostname, port)
std_error_message("Starting Cheroot at %s://%s:%s"
% (scheme, hostname, port))
server.start()
except KeyboardInterrupt:
server.stop()
sys.exit(0)
开发者ID:cdent,项目名称:tiddlywebplugins.cherrpy,代码行数:16,代码来源:cherrypy.py
示例17: initialize_app
def initialize_app(config, domain='our_test_domain', port=8001):
"""
Setup a wsgi intercepted server.
"""
config['server_host'] = {
'scheme': 'http',
'host': domain,
'port': str(port),
}
app = load_app()
def app_fn():
return app
httplib2_intercept.install()
wsgi_intercept.add_wsgi_intercept(domain, port, app_fn)
开发者ID:cdent,项目名称:tiddlywebplugins.oauth,代码行数:16,代码来源:fixtures.py
示例18: setup_module
def setup_module(module):
# cleanup
try:
shutil.rmtree('store')
except OSError:
pass
# establish web server
app = load_app()
def app_fn():
return app
httplib2_intercept.install()
wsgi_intercept.add_wsgi_intercept('our_test_domain', 8001, app_fn)
module.store = get_store(config)
module.http = httplib2.Http()
开发者ID:tiddlyweb,项目名称:tiddlywebplugins.etagcache,代码行数:16,代码来源:test_web_304.py
示例19: setup_module
def setup_module(module):
try:
shutil.rmtree('store')
except: # it's not there
pass
app = load_app()
def app_fn():
return app
module.store = get_store(config)
httplib2_intercept.install()
wsgi_intercept.add_wsgi_intercept('0.0.0.0', 8080, app_fn)
module.http = httplib2.Http()
开发者ID:tiddlyweb,项目名称:tiddlywebplugins.status,代码行数:16,代码来源:test_status.py
示例20: setup_module
def setup_module(module):
if os.path.exists("store"):
shutil.rmtree("store")
if CSRFProtector not in config["server_request_filters"]:
config["server_request_filters"].append(CSRFProtector)
app = load_app()
def app_fn():
return app
httplib2_intercept.install()
wsgi_intercept.add_wsgi_intercept("0.0.0.0", 8080, app_fn)
wsgi_intercept.add_wsgi_intercept("foo.0.0.0.0", 8080, app_fn)
module.http = httplib2.Http()
开发者ID:tiddlyweb,项目名称:tiddlywebplugins.csrf,代码行数:17,代码来源:test_post_validate.py
注:本文中的tiddlyweb.web.serve.load_app函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论