示例#1
0
文件: sync.py 项目: nlindblad/budget
def set_up(args):
    config = Config(args.config)
    db = Database(config.get_database_uri())
    db.create_tables()

    aggregator = Aggregator(db)
    slack = Slack(people=config.get_people(),
                  slack_config=config.get_slack_config(),
                  aggregator=aggregator)

    fixer = Fixer()

    logger = get_logger(args.debug)

    return config, db, slack, fixer, logger
示例#2
0
文件: web.py 项目: nlindblad/budget
    args_parser.add_argument("--debug",
                             help="Increase verbosity",
                             action="store_true")
    args_parser.add_argument(
        "--user-email",
        help="Pre-authenticated user e-mail",
    )
    return args_parser.parse_args()


app = Flask(__name__, static_url_path='/static')

args = parse_arguments()

config = Config(args.config)
db = Database(config.get_database_uri())
aggregator = Aggregator(db)

if args.user_email:
    config.pre_authenticated_user = args.user_email

google_client_id, google_client_secret = config.get_google_auth_credentials()

app.config.update(SECRET_KEY=google_client_secret,
                  GOOGLE_LOGIN_REDIRECT_SCHEME="https",
                  GOOGLE_LOGIN_CLIENT_ID=google_client_id,
                  GOOGLE_LOGIN_CLIENT_SECRET=google_client_secret)

login_manager = LoginManager(app)
google_login = GoogleLogin(app)