Exemplo n.º 1
0
            # TODO: Bug the slimit guys to support python 3
            #if not app.debug:
            #    javascript = minify(javascript)

            with open(os.path.join(app.static_folder, output), "w") as w:
                w.write(javascript)
                w.flush()

    d = os.walk('images')
    for f in list(d)[0][2]:
        outputpath = os.path.join(app.static_folder, os.path.basename(f))
        inputpath = os.path.join('images', f)
        copyfile(inputpath, outputpath)


@app.before_first_request
def compile_first():
    pass
    #prepare()


@app.before_request
def compile_if_debug():
    if app.debug and _cfg("debug-static-recompile").lower() in ['true', 'yes']:
        prepare()


if __name__ == '__main__':
    app.run(host=_cfg("debug-host"), port=_cfgi('debug-port'), debug=True)
Exemplo n.º 2
0
                    else:
                        javascript += coffeescript.compile(coffee, bare=bare)
            output = '.'.join(f.rsplit('.')[:-1]) + '.js'

            # TODO: Bug the slimit guys to support python 3
            #if not app.debug:
            #    javascript = minify(javascript)

            with open(os.path.join(app.static_folder, output), "w") as w:
                w.write(javascript)
                w.flush()

    d = os.walk('images')
    for f in list(d)[0][2]:
        outputpath = os.path.join(app.static_folder, os.path.basename(f))
        inputpath = os.path.join('images', f)
        copyfile(inputpath, outputpath)

@app.before_first_request
def compile_first():
    pass
    #prepare()

@app.before_request
def compile_if_debug():
    if app.debug and _cfg("debug-static-recompile").lower() in ['true','yes']:
        prepare()

if __name__ == '__main__':
    app.run(host=_cfg("debug-host"), port=_cfgi('debug-port'), debug=True)