from env import * from flask import Flask, render_template import os import FlowTest from sysjobs import * import sysjob2html import pandas as pd def create_app(test_config=None): # create and configure the app FlowAnalyserMain = Flask(__name__, instance_relative_config=True) #app.config.from_mapping( ## SECRET_KEY='dev', # DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite'), #) if test_config is None: # load the instance config, if it exists, when not testing FlowAnalyserMain.config.from_pyfile('config.py', silent=True) else: # load the test config if passed in FlowAnalyserMain.config.from_mapping(test_config) # ensure the instance folder exists try: os.makedirs(FlowAnalyserMain.instance_path) except OSError: pass # a simple page that says hello @FlowAnalyserMain.route('/hello') def hello(): return FlowTest.test() @FlowAnalyserMain.route('/test') def test(): listSysjobs=[] jobs=['BI - Flow - Batch Start – Daglig kl. 20.00','BI - Admin - Log Index Stats', 'BI - Flow - MDS Backup','BI - Admin - shrink staging filgruppe samt log filer' ,'BI - Flow - Batch Slut – Daglig kl. 20.00'] for job in jobs: listSysjobs.append(list(Sysjobs.getSysjob(session,job))[0]) return render_template('index.html', test=listSysjobs) @FlowAnalyserMain.route('/test3') def test3(): sysjobs=(Sysjobs.getNattensKoersel(session)) return render_template('index3.html', test3=sysjobs) @FlowAnalyserMain.route('/test2') def test2(): with Session(engine) as session: sysjobs=(Sysjobs.getNattensKoersel(session)) data2=json.dumps([str(b) for b in sysjobs]) return render_template('index2.html', test2=sysjobs) if __name__ == '__main__': FlowAnalyserMain.run() return FlowAnalyserMain engine=inn.getEngine("msdb") with Session(engine) as session: FlowAnalyserMain=create_app()