def auto_load_public(self): """Anything found in /public will be accessible by your app.""" ppath = self.public.public._loc[0] for f in utils.walkfiles(ppath, '*.css'): self.add_stylesheets(os.path.join('/public', f.relpath)) for f in utils.walkfiles(ppath, '*.js'): self.add_javascripts(os.path.join('/public', f.relpath))
def from_config_dir(cls, path, **opts): """Create an app given a path to the sphinx client and sim search configuration files. |-- config | |-- simsearch_client.py | |-- sphinx_client.py | `-- ... """ from fsphinx import FSphinxClient from simsearch import SimClient app = CloudMiningApp(**opts) if os.path.exists(path): for f in utils.walkfiles(path, '*.py'): if f.filename == 'sphinx_client.py' and not app.cl: app.set_fsphinx_client(FSphinxClient.FromConfig(f.abspath)) if f.filename == 'simsearch_client.py' and not app.sim_cl: app.set_sim_client(SimClient.FromConfig(f.abspath)) return app