示例#1
0
def create_app():
    template_folder = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates')
    static_folder = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'static')

    css_bundle = Bundle(
        'build/css/*.css',
        output='public/main.css')

    js_bundle = Bundle(
        'build/js/*.js',
        output='public/main.js')

    fonts_bundle = Bundle(
        'fonts/bootstrap/*')

    app = appfactory.create_app(
        'frontend',
        blueprints=blueprints,
        static_folder=static_folder,
        template_folder=template_folder)

    env = Environment(app)
    env.register('css_main', css_bundle)
    env.register('js_main', js_bundle)
    env.register('fonts_bundle', fonts_bundle)

    return app
示例#2
0
def create_frontend_app():
    template_folder = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates')
    static_folder = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', 'assets')

    app = appfactory.create_app(
        'frontend',
        blueprints=blueprints,
        static_folder=static_folder,
        template_folder=template_folder)

    return app
示例#3
0
def _create_app():

    app = appfactory.create_app('api')

    db.init_app(app)

    api = Api(app)
    api.add_resource(ItemsResource, '/item')
    api.add_resource(ItemResource, '/item/<int:item_id>')
    api.add_resource(PostsResource, '/post')
    api.add_resource(PostResource, '/post/<int:list_id>')

    return app