8 examples of 'flask app.run host' in Python

Every line of 'flask app.run host' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
71def _run_flask(self, host, port, debug=False, using_win32=False):
72 print host
73 if using_win32:
74 import pythoncom
75 pythoncom.CoInitialize()
76 self.flask_app.run(debug=debug, host=host, port=port,
77 use_reloader=False)
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

70def run_flask(self):
71 """
72 Run flask or other framework specified
73 """
74 if isinstance(self.server, str):
75 if self.server.lower() == "flask":
76 self.flask_app.run(host=self.host, port=self.port)
77 elif self.server.lower() == "django":
78 if sys.platform in ['win32', 'win64']:
79 os.system("python manage.py runserver {}:{}".format(self.host, self.port))
80 else:
81 os.system("python3 manage.py runserver {}:{}".format(self.host, self.port))
82 else:
83 raise Exception("{} must be a function which starts the webframework server!".format(self.server))
84 else:
85 self.server()
52def run(self, app, host, port):
53 httpd = simple_server.make_server(host, port, app)
54 httpd.serve_forever()
136def run(self, host, port, middleware=None):
137 """Werkzeug run implementation.
138
139 `middleware` may be provided as a function to handle
140 requests. It must accept the arguments `(handler, req)` where
141 `handler` is the TFServeApp request handler and `req` is the
142 request.
143
144 """
145 app = self._init_app(middleware)
146 server = serving.make_server(
147 host, port, app, threaded=True,
148 request_handler=serving.WSGIRequestHandler)
149 server.serve_forever()
122def run_default_server(app, port):
123 servers["werkzeug"](app, port, server_host)
326def run_server(app=None):
327 """Starts the web server running"""
328 server = make_server('', SERVICE_PORT, app)
329 logging.info("HTTP server on port %i running" % SERVICE_PORT)
330 # Respond to requests until process is killed
331 server.serve_forever()
62def run(self):
63 app = self.create_flask_app()
64 self.is_ready.set()
65 app.run(port=self.args.http_port, threaded=True, host='0.0.0.0')
85def run_server(self, app, host, port):
86 from tornado.wsgi import WSGIContainer
87 from tornado.httpserver import HTTPServer
88 from tornado.ioloop import IOLoop
89
90 http_server = HTTPServer(WSGIContainer(app))
91 http_server.listen(port, address=host)
92 IOLoop.instance().start()

Related snippets