diff --git a/lyrics/__init__.py b/lyrics/__init__.py index 5cc1e38..43b5f2c 100644 --- a/lyrics/__init__.py +++ b/lyrics/__init__.py @@ -12,6 +12,21 @@ import logging _log = logging.getLogger('lyrics') app = Flask(__name__) +app.config['SIDEBAR'] = [] + +# ---------------------------------------------------------------------- +# Import and register blueprints +# ---------------------------------------------------------------------- + +from lyrics.blueprints.index import index + +blueprints = [(index, '/', 'Index')] + +for (blueprint, path, title) in blueprints: + _log.debug('{blueprint} => "{path}" as "{title}"'.format( + blueprint=blueprint, path=path, title=title)) + app.register_blueprint(blueprint, url_prefix=path) + app.config['SIDEBAR'].append((title, path)) # ---------------------------------------------------------------------- # Start as application diff --git a/lyrics/blueprints/__init__.py b/lyrics/blueprints/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/lyrics/blueprints/index.py b/lyrics/blueprints/index.py new file mode 100644 index 0000000..f62207d --- /dev/null +++ b/lyrics/blueprints/index.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- + +from flask import Blueprint +from flask import render_template + +index = Blueprint('index', __name__) + +@index.route('/') +def root(): + return render_template('index.html')