run.py (1469B)
1 #!/usr/bin/env python3 2 # Copyright (c) 2019 Ivan Jelincic <parazyd@dyne.org> 3 # 4 # This file is part of diasporadiaries 5 # 6 # This program is free software: you can redistribute it and/or modify 7 # it under the terms of the GNU Affero General Public License as published by 8 # the Free Software Foundation, either version 3 of the License, or 9 # (at your option) any later version. 10 # 11 # This program is distributed in the hope that it will be useful, 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 # GNU Affero General Public License for more details. 15 # 16 # You should have received a copy of the GNU Affero General Public License 17 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 """ 19 Module/executable to start diasporadiaries 20 """ 21 22 from argparse import ArgumentParser 23 24 from bjoern import run 25 26 from diaspora import app 27 28 29 if __name__ == '__main__': 30 parser = ArgumentParser() 31 parser.add_argument('-l', default='127.0.0.1', 32 help='Address for listening (ex: 127.0.0.1)') 33 parser.add_argument('-p', default=8000, 34 help='Port for listening (ex: 8000)') 35 parser.add_argument('-d', action='store_true', default=False, 36 help='Debug mode') 37 args = parser.parse_args() 38 39 if args.d: 40 app.run(host=args.l, port=args.p, threaded=True, debug=args.d) 41 else: 42 run(app, args.l, args.p)