Exemplo n.º 1
0
import yaml
import flask


with open('config.yaml') as f:
    config = yaml.load(f)

app = flask.Flask('quickbudget')

@app.teardown_request
def shutdown_seesion(exception=None):
    from quickbudget.db import db_session

    db_session.commit()
    db_session.remove()

from quickbudget import db, pages

db.init_db(config['database'])
pages.init_routing(app)

if __name__ == "__main__":
    host = config['host']
    debug = config['debug']
    
    app.run(host=host, debug=debug)
Exemplo n.º 2
0
            if refNum == '':
                print 'SKIPPED ROW', rowNum, '- unknown refNum'
                print
                continue

            try:
                ReceiptImportData.get(refNum)
                print 'SKIPPED ROW', rowNum, '- imported already'
            except NoResultFound:
                recipe = Receipt()
                recipe.total = amount
                recipe.date = transDate
                recipe.note = description

                recipeImport = ReceiptImportData(recipe, bankImport, refNum, rowNum)

                session.add(recipe)
                session.add(recipeImport)
                session.commit()

            print

    bankImport.status = IMPORTSTATUS.completed
    session.commit()
    print 'Import of file', importLocation, 'done'


if __name__ == '__main__':
    db.init_db()
    importPekaoCreditCard(sys.argv[1], db.db_session)