예제 #1
0
def load_config():
    config = bottle.load('tangobello.config.base:config')
    app.config.load_dict(config)

    cur_env = env_detect().lower()

    if os.path.exists('config/%s.py' % cur_env):
        config = bottle.load('tangobello.config.%s:config' % cur_env)
        app.config.load_dict(config)
예제 #2
0
파일: giab.py 프로젝트: edersohe/giab
def create_app(prefix, routes):
    root = bottle.Bottle()
    app = bottle.Bottle()

    root_prefix = ('', None, '/')

    for key in routes:
        mod = bottle.load(key + '.routes')
        pk = mod.PK_REGEX if 'PK_REGEX' in mod.__dict__ else '[0-9]+'

        if 'index' in mod.__dict__:
            mod.app.route('/', 'GET', callback=mod.index)

        if 'create' in mod.__dict__:
            mod.app.route('/', 'POST', callback=mod.create)

        if 'read' in mod.__dict__:
            mod.app.route('/<pk:re:%s>' % pk, 'GET', callback=mod.read)

        if 'update' in mod.__dict__:
            mod.app.route('/<pk:re:%s>' % pk, 'PUT', callback=mod.update)

        if 'destroy' in mod.__dict__:
            mod.app.route('/<pk:re:%s>' % pk, 'DELETE', callback=mod.destroy)

        app.mount('/' + key, mod.app)

    if prefix in root_prefix:
        root.merge(app.routes)
    else:
        root.mount(prefix, app)

    return root
예제 #3
0
파일: core.py 프로젝트: ivanm11/dataflytest
def merge(default_app, sub_app, config=None):
    sub_app = load('%s_app' % sub_app)
    if config:
        sub_app.config(config)
    if Config.__name__ == 'Production':
        sub_app.catchall = False
    else:
        sub_app.add_hook('after_request', debug)
    default_app.merge(sub_app)
예제 #4
0
파일: atles_web.py 프로젝트: liffiton/ATLeS
    # let bottle know where to find our templates
    bottle.TEMPLATE_PATH.insert(0, str(config.TEMPLATEDIR))

    app = bottle.default_app()

    # install sqlalchemy plugin
    db_engine = sqlalchemy.create_engine('sqlite:///{}'.format(config.DBFILE),
                                         connect_args={'timeout': 10})
    db_schema.create_all(db_engine)  # create db/tables if not already there
    db_plugin = bottle.ext.sqlalchemy.Plugin(db_engine,
                                             keyword='db',
                                             commit=True)
    app.install(db_plugin)

    # setup error handlers
    bottle.load("web.error_handlers")

    # load modules with controllers / routes
    bottle.load("web.controller_static")
    bottle.load("web.controller_archive")
    bottle.load("web.controller_boxes")
    bottle.load("web.controller_analyze")
    bottle.load("web.controller_trackview")

    # start up the track scanner
    t = threading.Thread(target=auto_restart(track_scanner.scan_tracks),
                         args=[db_engine])
    t.daemon = True
    t.start()

    # add our boxes plugin
예제 #5
0
        pass
"""

def print_memory():
    print(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)
    #print(request.cookies)

routes={}

module_loaded=None

#Import modules to load

for module in config.modules:
    
    controller_path=load(module)
        
    controller_base=os.path.dirname(controller_path.__file__)
    
    base_module=module.split('.')[-1]
    
    arr_module_path[base_module]=controller_base
    
    dir_controllers=os.listdir(controller_base)
    
    #add_func_static_module(controller_base)

#Prepare ssl

if config.ssl==True: