You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.0 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. from flask import Flask, g, request, session, redirect, url_for, render_template
  2. from flask_bootstrap import Bootstrap
  3. import yaml
  4. app = Flask(__name__)
  5. Bootstrap(app)
  6. app.secret_key = 'asdf'
  7. app.debug = True
  8. with open('config/config.yaml') as f:
  9. yaml_data = yaml.load(f, Loader=yaml.SafeLoader)
  10. search = yaml_data['search']
  11. account_url = yaml_data['accounts']['account_url']
  12. description = yaml_data['description']
  13. countdown_data = None
  14. if yaml_data['countdown']['active'] == True:
  15. countdown_data = yaml_data['countdown']
  16. print(countdown_data)
  17. apps = []
  18. for itm in yaml_data['apps'].items():
  19. apps.append(itm[1])
  20. @app.route('/')
  21. def index():
  22. if countdown_data != None:
  23. return render_template('index.j2', apps = apps, search = search, account_url = account_url, description = description, countdown = countdown_data)
  24. return render_template('index.j2', apps = apps, search = search, account_url = account_url, description = description)
  25. if __name__ == '__main__':
  26. app.run(extra_files="config/config.yaml")