Home:ALL Converter>Flask routing issues on CherryPy

Flask routing issues on CherryPy

Ask Time:2012-08-28T17:41:01         Author:kilkurdu

Json Formatter

I tried the method on http://flask.pocoo.org/snippets/24/ to make Flask work on CheryPy server and It worked, no problem so far. But I can't route anything else but the "/". For example if I want to route to localhost/xyz, It returns "Hello World".

Should I create single Flask app for every single path?

the server.py is:

from cherrypy import wsgiserver
from qwe import app

d=wsgiserver.WSGIPathInfoDispatcher({"/":app,"/xyz":app})
server=wsgiserver.CherryPyWSGIServer(('0.0.0.0',80),d)

if __name__ == '__main__':
    try:
        server.start()
    except KeyboardInterrupt:
        server.stop()

the qwe.py is:

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World"

@app.route("/xyz")
def ff():
    return "Test1"

Author:kilkurdu,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/12156588/flask-routing-issues-on-cherrypy
yy