def run(self, host=None, port=None, debug=None, **options):
        app = self.app
        if app is None and 'app' in options:
            app = options['app']
        if app is None:
            raise Exception('"app" not defined')

        if host is None:
            host = '127.0.0.1'

        if port is None:
            server_name = app.config['SERVER_NAME']
            if server_name and ':' in server_name:
                port = int(server_name.rsplit(':', 1)[1])
            else:
                port = 5000

        if debug is not None:
            app.debug = bool(debug)

        self.run_simple(app, host, port, **options)
dataset/ETHPy150Open cravler/flask-twisted/flask_twisted/__init__.py/Twisted.run/original