def run(fsphinx_config='', sim_config='', from_dir='', port='', no_debug=False): if fsphinx_config: cl = FSphinxClient.FromConfig(fsphinx_config) else: cl = None if sim_config: sim_cl = SimClient.FromConfig(sim_config) else: sim_cl = None if no_debug: autoreload = False else: autoreload = True if from_dir: app = CloudMiningApp.from_directory(from_dir, cl=cl, sim_cl=sim_cl, autoreload=autoreload) else: app = CloudMiningApp(cl, sim_cl, autoreload=autoreload) if port: app.set_port(port) if no_debug: app.debug = False app.template_caching = True app.run()
#!/usr/bin/env python from fsphinx import FSphinxClient from simsearch import SimClient from cloudmining import CloudMiningApp # create a FSphinxClient from the configuration file cl = FSphinxClient.FromConfig('config/sphinx_client.py') # create similarity search client sim_cl = SimClient.FromConfig('config/simsearch_client.py') # create a new CloudMining web application app = CloudMiningApp(autoreload=True) # set the fsphinx client of the webapp app.set_fsphinx_client(cl) # same for similarity search app.set_sim_client(sim_cl) # if cl has a search cache preload it app.set_preload_cache_file('data/redis-cache.dat') # some more options which can be set app.set_debug(True) # also web.config.debug app.set_template_caching(False) # also web.config.template_caching app.set_flush_cache_on_startup(True) # what sorting options are shown (key must match cl sort options) app.set_ui_sort_by(dict(key='cit', description='number of citations'), dict(key='rel', description='relevance'),