--autoreload preventing server launch in Flask web app

I don’t know if the title of the issue is accurate because it can be less obvious than it appears but I have no idea of what is causing that.

I’m trying to debug a single page web app developped with Flask and Panel. It has been containerized with Docker.

I’m using this command to launch it :

python -m panel serve --port=8080 --address= --websocket-max-message-size=100000000 app.py

and it works fine, i’m getting the output as expected:

2022-03-25 08:26:32,495 Starting Bokeh server version 2.4.2 (running on Tornado 6.1)
2022-03-25 08:26:32,496 Torndado websocket_max_message_size set to 100000000 bytes (95.37 MB)
2022-03-25 08:26:32,496 User authentication hooks NOT provided (default user enabled)
2022-03-25 08:26:32,498 Bokeh app running at:
2022-03-25 08:26:32,498 Starting Bokeh server with process id: 39

However when i add the --autoreload option to the panel serve command I get:

Launching server at http://localhost:38647

And nothing happens…

ALL software version info

  • python 3.8
    • matplotlib 3.5.1
    • panel 0.12.6
    • bokeh 2.4.2
    • holoviews 1.14.8
    • datashader 0.13.0
    • hvplot 0.7.3
    • shapely 1.8.1.post1
    • xarray 2022.3.0
    • h5netcdf 0.15.0
    • scipy 1.8.0
    • requests 2.27.1
    • spatialpandas 0.4.3
    • jinja2 3.0.2
  • Debian GNU/Linux 11


FROM python:3.8

RUN apt-get update && apt-get install -y libgeos-dev

COPY requirements.*txt /tmp/
RUN pip install --no-cache-dir -r /tmp/requirements.txt

WORKDIR /usr/src/app
COPY app.py .

ENTRYPOINT python -m panel serve --port=8080 --address= --websocket-max-message-size=100000000 app.py

Do you have an idea of what is happening ?

Thank you for your help !

1 Like

The thing I notice is that the ports are different (38647 and 8080). The command running the container needs to open/ expose the relevant port. Did you do that?

Yes I’m building the app through a docker-compose.yml:

version: '3'
      context: .
      dockerfile: single_page_webapp.Dockerfile
    env_file: ${PANEL_CONFIG}
      - 8080
      - "8080:8080"
      - .:/usr/src/app

And yes I don’t really understand why the app is deployed at port 38647

It could be because app.py has a “.show()” on one of the widgets.

I’m not using .show() in the app.py

It is hard to say without knowing what is inside app.py. Can you see if the problem is still there if you change app.py to:

import panel as pn
1 Like

Ok it works in this case with app.py:

import panel as pn

Thank you for your help, I need to investigate that