[Solved] Running Gunicorn with flask.... - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: [Solved] Running Gunicorn with flask.... (/thread-37577.html) |
[Solved] Running Gunicorn with flask.... - SpongeB0B - Jun-27-2022 Hi everyone, I try to run Flask with gunicorn I've created a venv , here the simple structure Quote:. Running Flask_test.py with the embedded dev. server is running smoothly #Flask_test.py from flask import Flask app = Flask(__name__) @app.route("/") def hello_world(): return "<p>Hello, <b>World!</b></p>" if __name__ == "__main__": #app.run(host, port, debug, options) app.run('127.0.0.1',5000,True) now with gunicorn... All around the www I see that I need to create another .py file and call this one that will call Flask_test.py why so many redirection ? is there a way to launch unicorn with Flask_test.py directly ? Thanks. Edit: With waitress I could launch it like this Python3.9 Flask_test.py and in Flask_test.py I would have: from waitress import serve #....... if __name__ == "__main__": serve(app, host='127.0.0.1', port=5000, ipv6=False)so simple... RE: Running Gunicorn with flask.... - SpongeB0B - Jun-27-2022 I found !!! It was ~simple... gunicorn -w 6 Flask_test:app |