|
|
- from flask import Flask, g, request, session, redirect, url_for, render_template
- from flask_bootstrap import Bootstrap
- import yaml
-
- app = Flask(__name__)
- Bootstrap(app)
- app.secret_key = 'asdf'
- app.debug = True
-
- with open('config/config.yaml') as f:
- yaml_data = yaml.load(f, Loader=yaml.SafeLoader)
-
- search = yaml_data['search']
- account_url = yaml_data['accounts']['account_url']
-
- description = yaml_data['description']
-
- countdown_data = None
- if yaml_data['countdown']['active'] == True:
- countdown_data = yaml_data['countdown']
- print(countdown_data)
-
- apps = []
- for itm in yaml_data['apps'].items():
- apps.append(itm[1])
-
-
- @app.route('/')
- def index():
- if countdown_data != None:
- return render_template('index.j2', apps = apps, search = search, account_url = account_url, description = description, countdown = countdown_data)
- return render_template('index.j2', apps = apps, search = search, account_url = account_url, description = description)
-
-
- if __name__ == '__main__':
- app.run(extra_files="config/config.yaml")
|