[web] Late init of storage engine.
This commit is contained in:
parent
8e59d3d661
commit
873cff4229
1 changed files with 5 additions and 1 deletions
|
@ -11,6 +11,7 @@ from flask.ext.sqlalchemy import SQLAlchemy
|
||||||
from flask.ext.script import Manager
|
from flask.ext.script import Manager
|
||||||
from flask.ext.migrate import Migrate, MigrateCommand
|
from flask.ext.migrate import Migrate, MigrateCommand
|
||||||
|
|
||||||
|
from accounting.storage import Storage
|
||||||
from accounting.storage.ledgercli import Ledger
|
from accounting.storage.ledgercli import Ledger
|
||||||
from accounting.storage.sql import SQLStorage
|
from accounting.storage.sql import SQLStorage
|
||||||
from accounting.transport import AccountingEncoder, AccountingDecoder
|
from accounting.transport import AccountingEncoder, AccountingDecoder
|
||||||
|
@ -21,7 +22,7 @@ from accounting.decorators import jsonify_exceptions
|
||||||
app = Flask('accounting')
|
app = Flask('accounting')
|
||||||
app.config.from_pyfile('config.py')
|
app.config.from_pyfile('config.py')
|
||||||
|
|
||||||
storage = Ledger(app=app)
|
storage = Storage()
|
||||||
|
|
||||||
if isinstance(storage, SQLStorage):
|
if isinstance(storage, SQLStorage):
|
||||||
# TODO: Move migration stuff into SQLStorage
|
# TODO: Move migration stuff into SQLStorage
|
||||||
|
@ -152,6 +153,9 @@ def main(argv=None):
|
||||||
help=('Filter logging output. Possible values:' +
|
help=('Filter logging output. Possible values:' +
|
||||||
' CRITICAL, ERROR, WARNING, INFO, DEBUG'))
|
' CRITICAL, ERROR, WARNING, INFO, DEBUG'))
|
||||||
|
|
||||||
|
global storage
|
||||||
|
storage = Ledger(app=app)
|
||||||
|
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
|
|
||||||
logging.basicConfig(level=getattr(logging, args.verbosity, 'INFO'))
|
logging.basicConfig(level=getattr(logging, args.verbosity, 'INFO'))
|
||||||
|
|
Loading…
Reference in a new issue