Integrating dash in cherrypy

Hello:

Is there anyway to integrate a Dash app using cherrypy instead of Flask?

Here is my code:

import dash
import cherrypy
import dash_core_components as dcc
import dash_html_components as html

external_stylesheets=['https://codepen.io/chriddyp/pen/bWLwgP.css']
appl= dash.Dash(__name__, external_stylesheets=external_stylesheets)

appl.layout=...

class Root(object):

    def index(self):
        output='''
        "Access the <a href="dash">application</a>"
        '''
        return output
    index.exposed=True

    def dash(self):
        return appl
    
    dash.exposed=True
    


if __name__ == '__main__':  
    configfile=os.path.join(os.path.dirname(__file__), 'server.conf')
    cherrypy.quickstart(Root(), script_name='/', config=configfile)

I get the error:
TypeError: ‘Dash’ object is not iterable

I think I’m very close, but I have the feeling that there is one missing piece

Thank you!

Hi @pablomarina, maybe you mean how to use cherrypy wsgi/cheroot with Dash?

For more info, you can check this out: DASH Deployment: HELP!

Yeah, it was that. Fortunately I finally worked it out during this time.

Thanks for replying anyway.

@pablomarina Can you explain what got it working?

Just using Cheroot function, specifying IP direction or hostname, port number and number of threads. No need to use Cherrypy framework, could be another one (e.g. flask)

1 Like

@pablomarina Hi just did, works well, although no reload function when developing.