示例#1
0
def build_app(app):
    app.register_blueprint(auth_bundle)
    app.register_blueprint(home_bundle)
    app.register_blueprint(api_bundle)
    app.register_blueprint(profile_bundle)
    app.register_blueprint(content_bundle)
    app.register_blueprint(search_bundle)
    # Config to Flask from objects
    # app.config.from_object('fedora_college.core.ProductionConfig')
    app.config.from_object('fedora_college.core.config.DevelopmentConfig')
    db.init_app(app)

    # FAS OpenID Instance
    with app.app_context():
        whooshalchemy.whoosh_index(app, Content)
        whooshalchemy.whoosh_index(app, Media)
        DebugToolbarExtension(app)
        admin = Admin(
            app, 'Auth', index_view=FedoraAdminIndexView())
        admin.add_view(FedoraModelView(UserProfile, db.session))
        admin.add_view(FedoraModelView(Content, db.session))
        admin.add_view(FedoraModelView(Media, db.session))
        admin.add_view(FedoraModelView(Tags, db.session))
        admin.add_view(
            FedoraFileView(
                current_app.config['STATIC_FOLDER'],
                name='Static Files'
            )
        )
        current_app.config['fas'] = FAS(app)
示例#2
0
def build_app(app):
    app.register_blueprint(auth_bundle)
    app.register_blueprint(home_bundle)
    app.register_blueprint(api_bundle)
    app.register_blueprint(profile_bundle)
    app.register_blueprint(content_bundle)
    app.register_blueprint(search_bundle)
    # Config to Flask from objects
    # app.config.from_object('fedora_college.core.ProductionConfig')
    app.config.from_object('fedora_college.core.config.DevelopmentConfig')
    db.init_app(app)

    # FAS OpenID Instance
    with app.app_context():
        whooshalchemy.whoosh_index(app, Content)
        whooshalchemy.whoosh_index(app, Media)
        DebugToolbarExtension(app)
        admin = Admin(app, 'Auth', index_view=FedoraAdminIndexView())
        admin.add_view(FedoraModelView(UserProfile, db.session))
        admin.add_view(FedoraModelView(Content, db.session))
        admin.add_view(FedoraModelView(Media, db.session))
        admin.add_view(FedoraModelView(Tags, db.session))
        admin.add_view(
            FedoraFileView(current_app.config['STATIC_FOLDER'],
                           name='Static Files'))
        current_app.config['fas'] = FAS(app)
示例#3
0
def drop_db(app):
    db.init_app(app)
    with app.app_context():
        db.drop_all()
示例#4
0
def create_db(app):
    db.init_app(app)
    with app.app_context():
        db.drop_all()
        db.create_all()
示例#5
0
def create_db(app):
    db.init_app(app)
    with app.app_context():
        db.drop_all()
        db.create_all()
示例#6
0
def drop_db(app):
    db.init_app(app)
    with app.app_context():
        db.drop_all()