aboutsummaryrefslogtreecommitdiffstats
path: root/run.py
blob: c8f492ea97ed1ad838aa6cf05b4cfad29f5a4918 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

import argparse
from fatcat import app, db

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--debug',
        action='store_true',
        help="enable debugging interface")
    parser.add_argument('--host',
        default="127.0.0.1",
        help="listen on this host/IP")
    parser.add_argument('--port',
        type=int,
        default=8040,
        help="listen on this port")
    parser.add_argument('--database-uri',
        default=app.config['DATABASE_URI'],
        help="sqlalchemy database string")
    args = parser.parse_args()

    app.config['DATABASE_URI'] = args.database_uri
    db.create_all()
    app.run(debug=args.debug, host=args.host, port=args.port)

if __name__ == '__main__':
    main()