Beispiel #1
0
def configure_database(app):
    create_database()

    @app.teardown_request
    def shutdown_session(exception=None):
        db.session.remove()

    migrate = Migrate(app, db)
Beispiel #2
0
def configure_database(app):
    create_database()

    @app.teardown_request
    def shutdown_session(exception=None):
        db.session.remove()

    Migrate(app, db)

    @app.before_first_request
    def create_default():
        create_default_scripts()
        create_default_filters()
Beispiel #3
0
def configure_database(app):
    create_database()

    @app.teardown_request
    def shutdown_session(exception=None):
        db.session.remove()
    Migrate(app, db)

    for name, action in (
        ('NAPALM Commit', 'commit_config'),
        ('NAPALM Discard', 'discard_config'),
        ('NAPALM Rollback', 'rollback')
    ):
        try:
            script = NapalmActionScript(name, action)
            db.session.add(script)
            db.session.commit()
        except exc.IntegrityError as e:
            db.session.rollback()
#base_app.route = ajax.route

# XXX: This is the preliminary use of autoindex
# AutoIndex(base_app, browse_root="templates")


# ##############################################################################
# Setup jinja globals for templates
base_app.jinja_env.globals["content_modules"] = base_app.content_modules
base_app.jinja_env.globals["degrees"] = base_app.config['DEGREE_PROGRAMS']

# #############################################################################
# Section: Test the database, and should the user or role tables fail to exist
#          create them (this must be done :'( )

create_database()

if base_app.debug is True:
    # ##############################################################################
    # Enable less-css compile on demand (see utils/lesscss.py)

    lesscss(base_app)



# ##############################################################################
# Section: Interface functions
# Synop: This section contains interface functions which are used to hook 
#        into and control the websites base

# ##############################################################################