Panel server embedded in Flask/gunicorn

Hi @_jm

According to Allow Serving Flask Apps PR one way to do it is

import panel as pn
from flask import Flask

flask_app = Flask(__name__)

@flask_app.route('/app')
def hello_world():
    return 'Hello, World!'

def panel_app():
    return "# This Panel app runs alongside flask, access the flask app at [here](./flask/app)"

pn.serve({'/flask': flask_app, 'panel': panel_app}, port=5001)

I believe you can find additional inspiration in

If you learn anything please, please share to make it easier for others to do as well.

You can share it here or even better as a contribution to the Panel documentation similar to the Django Apps documentation.

Thanks.

1 Like