setup_app.py 524 Bytes
Newer Older
Nicolas Joyard's avatar
Nicolas Joyard committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
# -*- coding: utf-8 -*-

import os

from flask import Flask
from flaskext.markdown import Markdown

from .routes import setup_routes


def setup_app(name):
    # Create app
    app = Flask(name)

    # Load config
    config_obj = os.environ.get('IRFM_CONFIG',
                                'irfm.config.DefaultConfig')
    app.config.from_object(config_obj)

    # Setup DB
    from .models import db
    db.init_app(app)

    # Enable Markdown
    Markdown(app)

    # Setup routes
    setup_routes(app)

    return app