Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing CherryPy/Cherryd to launch multiple Flask instances
    primarykey
    data
    text
    <p>Per suggestions on SO/SF and other sites, I am using CherryPy as the WSGI server to launch multiple instances of a Python web server I built with Flask. Each instance runs on its own port and sits behind Nginx. I should note that the below does work for me, but I'm troubled that I have gone about things the wrong way and it works "by accident".</p> <p>Here is my current cherrypy.conf file:</p> <pre><code>[global] server.socket_host = '0.0.0.0' server.socket_port = 8891 request.dispatch: cherrypy.dispatch.MethodDispatcher() tree.mount = {'/':my_flask_server.app} </code></pre> <p>Without diving too far into my Flask server, here's how it starts:</p> <pre><code>import flask app = flask.Flask(__name__) @app.route('/') def hello_world(): return "hello" </code></pre> <p>And here is the command I issue on the command line to launch with Cherryd:</p> <pre><code>cherryd -c cherrypy.conf -i my_flask_server </code></pre> <p><strong>Questions are:</strong></p> <ol> <li><p>Is wrapping Flask inside CherryPy still the preferred method of using Flask in production? <a href="https://stackoverflow.com/questions/4884541/cherrypy-vs-flask-werkzeug">https://stackoverflow.com/questions/4884541/cherrypy-vs-flask-werkzeug</a></p></li> <li><p>Is this the proper way to use a .conf file to launch CherryPy and import the Flask app? I have scoured the CherryPy documentation, but I cannot find any use cases that match what I am trying to do here specifically.</p></li> <li><p>Is the proper way to launch multiple CherryPy/Flask instances on a single machine to execute multiple cherryd commands (daemonizing with -d, etc) with unique .conf files for each port to be used (8891, 8892, etc)? Or is there a better "CherryPy" way to accomplish this?</p></li> </ol> <p>Thanks for any help and insight.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload