import argparse import sys # Local modules from flaskapp.app import app def get_args(): """ Get command-line arguments """ parser = argparse.ArgumentParser() parser.add_argument('--host', type=str, default='0.0.0.0', help='Sets the host on which the app is to be run') parser.add_argument('--port', type=int, default=5000, help='Sets the port on which the app is to be run') parser.add_argument('--debug', action='store_true', help='Run in debug mode') args = parser.parse_args() return args if __name__ == "__main__": args = get_args() app.run(host=args.host, port=args.port, debug=args.debug)
import sys from flaskapp.app import app from flaskapp.setup_db import main as init_db if (len(sys.argv) > 1) and (sys.argv[1] == '1'): if len(sys.argv) > 3: init_db(sys.argv[3]) else: init_db() debug = False if len(sys.argv) > 2 and sys.argv[2] == '0': debug = True app.run(host='0.0.0.0', debug=debug)
import sys sys.path.append('../') # Must have a best solution from flaskapp.app import app as application if __name__ == "__main__": application.run()
""" File: run_server.py Author: Dibyaranjan Sathua Created on: 21/01/21, 10:52 pm """ from flaskapp.app import app if __name__ == "__main__": app.run()