Ejemplo n.º 1
0
def create_app():
    # initialize local db
    JavManagerDB()

    # create and configure the app
    app = Flask(__name__, template_folder='templates')
    cache.init_app(app)

    app.register_blueprint(emby_actress)
    app.register_blueprint(parse_jav)
    app.register_blueprint(jav_browser)
    app.register_blueprint(directory_scan)

    app.config['JSON_AS_ASCII'] = False

    # a simple page that says hello
    @app.route('/')
    def hello():
        return render_template('home.html')

    @app.errorhandler(Exception)
    def handle_exception(e):
        # pass through HTTP errors
        if isinstance(e, HTTPException):
            return e

        print_exc()
        # now you're handling non-HTTP exceptions only
        return jsonify({'errors': format_exc()}), 500

    return app
Ejemplo n.º 2
0
def create_app():
    # initialize local db and index
    _db = JavManagerDB()
    _db.create_indexes()

    # create and configure the app
    app = Flask(__name__, template_folder='templates')
    cache.init_app(app)

    app.register_blueprint(emby_actress)
    app.register_blueprint(parse_jav)
    app.register_blueprint(javlib_browser)
    app.register_blueprint(javbus_browser)
    app.register_blueprint(javdb_browser)
    app.register_blueprint(jav777_browser)
    app.register_blueprint(directory_scan)
    app.register_blueprint(local_manager)

    app.config['JSON_AS_ASCII'] = False

    # a simple page that says hello
    @app.route('/')
    def hello():
        return render_template('home.html')

    @app.route('/demo/<path:path>')
    def serve_demo_images(path):
        return send_from_directory(resource_path('demo'), path)

    @app.errorhandler(Exception)
    def handle_exception(e):
        # pass through HTTP errors
        if isinstance(e, HTTPException):
            return e

        print_exc()
        # now you're handling non-HTTP exceptions only
        return jsonify({'error': format_exc()}), 500

    return app