Пример #1
0
def create_app(config_filename='config.yaml'):

    app = App(__name__, static_url_path='/static', static_folder=xdg_static_folder())
    app.url_map.converters.update(dict(
        sid=SIDConverter,
        sha1=SHA1Converter,
        label=LabelConverter,
        namespace=NamespaceConverter,
        handler=HandlerConverter
    ))

    load_config(app, config_filename)
    init_db(app)
    init_cache(app)
    init_template(app)
    init_logging(app)

    app.after_request(cors)

    app.register_blueprint(paste)
    app.register_blueprint(namespace)

    # error handlers
    app.register_error_handler(StopIteration, lambda _: StatusResponse("not found", 404))

    app.url_map.update()
    #print('\n'.join(repr(i) for i in app.url_map._rules))

    return app
Пример #2
0
def create_app(config_filename='config.yaml'):
    app = App(__name__)
    app.url_map.converters.update(dict(
        sid = SIDConverter,
        sha1 = SHA1Converter,
        label = LabelConverter,
        namespace = NamespaceConverter,
        handler = HandlerConverter
    ))

    load_config(app, config_filename)
    init_db(app)
    init_cache(app)
    init_cdn(app)
    init_logging(app)

    app.after_request(cors)

    app.register_blueprint(paste)
    app.register_blueprint(namespace)

    app.url_map.update()
    #print('\n'.join(repr(i) for i in app.url_map._rules))

    return app
Пример #3
0
def create_app(config_filename='config.yaml'):
    app = Flask(__name__)
    app.response_class = TextResponse
    app.url_map.converters['id'] = IDConverter
    app.url_map.converters['sha1'] = SHA1Converter

    load_yaml(app, config_filename)
    init_db(app)
    init_cache(app)

    app.register_blueprint(paste)
    app.register_blueprint(url)

    return app
Пример #4
0
Файл: pb.py Проект: GermainZ/pb
def create_app(config_filename='config.yaml'):
    app = Flask(__name__)
    app.response_class = TextResponse
    app.url_map.converters['id'] = IDConverter
    app.url_map.converters['sha1'] = SHA1Converter

    load_yaml(app, config_filename)
    init_db(app)
    init_cache(app)

    app.register_blueprint(paste)
    app.register_blueprint(url)

    return app
Пример #5
0
Файл: pb.py Проект: jstoone/pb
def create_app(config_filename='config.yaml'):
    app = App(__name__)
    app.url_map.converters.update(dict(
        sid = SIDConverter,
        sha1 = SHA1Converter,
        label = LabelConverter,
        namespace = NamespaceConverter
    ))

    load_config(app, config_filename)
    init_db(app)
    init_cache(app)

    app.after_request(cors)

    app.register_blueprint(paste)
    app.register_blueprint(namespace)

    app.url_map.update()
    #print('\n'.join(repr(i) for i in app.url_map._rules))

    return app