def mount_sub_apps(root): app_names = get_app_names() version = get_version() if len(version) != 0: version = "/" + version for app_name in app_names: api_app, page_app = find_applications('apps.{0}'.format(app_name)) if api_app is not None: root.mount('{1}/{0}/api'.format(app_name, version), api_app) if page_app is not None: root.mount('{1}/{0}'.format(app_name, version), page_app)
def initiate_db_fapp(): session = session_factory() db_apps = session.query(FappModel).all() db_apps_names = [x.name for x in db_apps] apps = get_app_names() for fap in apps: # not in db ? We create the fapp if fap not in db_apps_names: scheduled = not globals()[fap].PLAYABLE click.echo("Creating app {} (scheduled = {})...".format(fap, scheduled)) db_fap = FappModel(fap, is_scheduled=scheduled) session.add(db_fap) session.commit() session.close()
''' import os from core import Application, make_app_wrappers, static_file, redirect from core.settings import settings from core import request from apps import get_app_names, get_app_dirs_dict, get_root_dir #from common.auth import no_auth, get_token_from_request app = Application() get, post, default_error = make_app_wrappers(app, ['get', 'post', 'default_error']) app_dir_dict = get_app_dirs_dict() root_dir = get_root_dir() app_names = get_app_names() # useless in production mode, because nginx will override these rules if settings.ENV_MODE == 'development': print "development mode start" @get('/static/<filename:path>') def serve_static(filename): return static_file(filename, root=os.path.join(root_dir, 'static')) @get('/') @get('/index') @get('/index.html') def serve_index(): #token = get_token_from_request(request) #if token is None:
@author: Shao Guojian ''' import os from core import Application, make_app_wrappers, static_file, redirect from core.settings import settings from core import request from apps import get_app_names, get_app_dirs_dict, get_root_dir #from common.auth import no_auth, get_token_from_request app = Application() get, post, default_error = make_app_wrappers(app, ['get', 'post', 'default_error']) app_dir_dict = get_app_dirs_dict() root_dir = get_root_dir() app_names = get_app_names() # useless in production mode, because nginx will override these rules if settings.ENV_MODE == 'development': print "development mode start" @get('/static/<filename:path>') def serve_static(filename): return static_file(filename, root=os.path.join(root_dir, 'static')) @get('/') @get('/index') @get('/index.html') def serve_index(): #token = get_token_from_request(request) #if token is None: