diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-07-26 01:04:48 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-07-26 01:04:48 -0700 |
commit | 87099999ebf58b31e2fecd1e3b57bf6712f08b76 (patch) | |
tree | 635a15fcac8466e83c49ef732eb3cf0d175efe55 /python/fatcat_webface.py | |
parent | 20b3a58bf8dcd0e63ec6cfb8f13ebfb83d83c927 (diff) | |
download | fatcat-87099999ebf58b31e2fecd1e3b57bf6712f08b76.tar.gz fatcat-87099999ebf58b31e2fecd1e3b57bf6712f08b76.zip |
rename python scripts
Diffstat (limited to 'python/fatcat_webface.py')
-rwxr-xr-x | python/fatcat_webface.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/python/fatcat_webface.py b/python/fatcat_webface.py new file mode 100755 index 00000000..cfddad48 --- /dev/null +++ b/python/fatcat_webface.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 + +import argparse +from fatcat import app + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--debug', + action='store_true', + help="enable debugging interface (note: not for everything)") + parser.add_argument('--host', + default="127.0.0.1", + help="listen on this host/IP") + parser.add_argument('--port', + type=int, + default=9810, + help="listen on this port") + parser.add_argument('--database-uri', + default=app.config['SQLALCHEMY_DATABASE_URI'], + help="sqlalchemy database string") + parser.add_argument('--init-db', + action='store_true', + help="create database tables and insert dummy data") + args = parser.parse_args() + + app.config['SQLALCHEMY_DATABASE_URI'] = args.database_uri + + if args.init_db: + db.create_all() + fatcat.sql.populate_db() + print("Dummy database configured: " + app.config['SQLALCHEMY_DATABASE_URI']) + return + + app.run(debug=args.debug, host=args.host, port=args.port) + +if __name__ == '__main__': + main() |