Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panel serve: cannot set app as an index. #3208

Closed
mjmare opened this issue Feb 21, 2022 · 9 comments · Fixed by #3221
Closed

Panel serve: cannot set app as an index. #3208

mjmare opened this issue Feb 21, 2022 · 9 comments · Fixed by #3221
Labels
type: docs Related to the Panel documentation and examples
Milestone

Comments

@mjmare
Copy link

mjmare commented Feb 21, 2022

I tried to set a panel app as the index, like so:

panel serve ../src/dashboard/apps/* --index start_here

This will generate this exception when accessing the app at http://localhost:5006:

2022-02-21 12:04:02,825 Uncaught exception GET / (::1)
HTTPServerRequest(protocol='http', host='localhost:5006', method='GET', uri='/', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
  File "/Users/mjm/Dropbox/Devel/ACHN/Dashboard/.venv/lib/python3.8/site-packages/tornado/web.py", line 1704, in _execute
    result = await result
  File "/Users/mjm/Dropbox/Devel/ACHN/Dashboard/.venv/lib/python3.8/site-packages/panel/io/server.py", line 275, in get
    await super().get(*args, **kwargs)
  File "/Users/mjm/Dropbox/Devel/ACHN/Dashboard/.venv/lib/python3.8/site-packages/bokeh/server/views/root_handler.py", line 66, in get
    self.render(index, prefix=prefix, items=sorted(self.applications.keys()))
  File "/Users/mjm/Dropbox/Devel/ACHN/Dashboard/.venv/lib/python3.8/site-packages/tornado/web.py", line 862, in render
    raise RuntimeError("Cannot render() after finish()")
RuntimeError: Cannot render() after finish()

Please see discussion here:
https://discourse.holoviz.org/t/cannot-set-panel-app-as-index-with-index-option/3202/2

@MarcSkovMadsen
Copy link
Collaborator

I would like to be able to set an app as the index. This seems very natural.

@philippjfr
Copy link
Member

To be clear this is supported but I think you'd have to use --index start_here.py. I'll make this more robust and fix that RuntimeError though.

@MarcSkovMadsen MarcSkovMadsen added type: bug type: docs Related to the Panel documentation and examples labels Feb 21, 2022
@MarcSkovMadsen MarcSkovMadsen added this to the v0.13.0 milestone Feb 21, 2022
@mjmare
Copy link
Author

mjmare commented Feb 21, 2022

Don't think so. If I pass a non-existing app panel serve will raise an error.

ERROR: The --index argument must either specify a jinja2 template with a .html file extension or select one of the applications being served as the default. The specified application 'start_hereXX' could not be found.

@philippjfr
Copy link
Member

If I pass a non-existing app panel serve will raise an error.

I think the validation logic is just not correctly implemented. I'm using the app as an index pattern successfully in a number of production applications.

@mjmare
Copy link
Author

mjmare commented May 3, 2022

AFAICT this is not fixed in Panel v0.13.0.

This won't work:

--index /absolute/path/to/default_app_dir
--index /absolute/path/to/default_app_dir/main.py
--index default_app_dir

The only thing that works is:

--index /absolute/path/to/index.html

If it is fixed, please update the docs and CLI help

@philippjfr
Copy link
Member

Thanks @mjmare! You are indeed correct, directory based apps are not supported right now. Could you open another issue?

@mjmare
Copy link
Author

mjmare commented May 3, 2022

Done.

@philippjfr
Copy link
Member

Really appreciate it @mjmare!

@mjmare
Copy link
Author

mjmare commented May 3, 2022

Of course. No prob.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs Related to the Panel documentation and examples
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants