from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
Waitress on the other hand is a pure-Python WSGI server, and here's normal usage of the server:
from waitress import serve
serve(wsgiapp, host='0.0.0.0', port=8080)
So, here is how I wrote code to run Flask from within a Waitress WSGI Server:
from flask import Flask
from waitress import serve
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
#app.run()
serve(app)
Documentations:
http://flask.pocoo.org/docs/
https://github.com/Pylons/waitress/blob/master/docs/index.rst
No comments:
Post a Comment