accountant/accountant/__init__.py

41 lines
1.2 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
# The app
app = Flask(__name__, static_folder=None)
app.config.from_pyfile('config.cfg')
app.config['SQLALCHEMY_ECHO'] = app.debug
app.config['SQLALCHEMY_COMMIT_ON_TEARDOWN'] = True
db = SQLAlchemy(app)
# Must be after db declaration because some components in blueprints need it.
from .api import blueprint as api
app.register_blueprint(api, url_prefix='/api')
# Redirect / to API documentation.
@app.route('/')
def index():
return redirect(url_for('api.doc'))