accountant/accountant/__init__.py
2015-11-27 12:28:44 +01:00

57 lines
1.7 KiB
Python

"""
This file is part of Accountant.
Accountant is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Accountant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Accountant. If not, see <http://www.gnu.org/licenses/>.
"""
from flask import Flask, redirect, url_for
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.bower import Bower
from flask.ext.assets import Environment
from flask.ext.login import LoginManager
# The app
app = Flask(__name__, static_folder=None)
app.config.from_pyfile('config.cfg')
# Configure login_manager
login_manager = LoginManager(app=app)
app.config['SQLALCHEMY_ECHO'] = app.debug
db = SQLAlchemy(app)
# Must be after db declaration because the blueprints may need it.
from .api import api
from .frontend import frontend, frontend_js, frontend_css
app.register_blueprint(frontend, url_prefix='/app')
app.register_blueprint(api, url_prefix='/api')
app.config['BOWER_COMPONENTS_ROOT'] = "../bower_components"
app.config['BOWER_TRY_MINIFIED'] = not app.debug
bower = Bower(app)
assets = Environment(app)
assets.register('frontend_js', frontend_js)
assets.register('frontend_css', frontend_css)
@app.route('/')
def index():
return redirect(url_for('frontend.index'))