How to add a status page when panel serve

Something like

When I do: panel serve app.py status.py

status.py

import panel as pn
pn.extension()

pn.pane.Markdown("it is running").servable()

I get a 200, but also a lot of extra stuff:


​
<!DOCTYPE html>
<html lang="en">
  
  <head>
    
      <meta charset="utf-8">
      <title>Panel Application</title>
      
      
        
          
        <link rel="stylesheet" href="static/extensions/panel/css/alerts.css" type="text/css" />
        <link rel="stylesheet" href="static/extensions/panel/css/card.css" type="text/css" />
        <link rel="stylesheet" href="static/extensions/panel/css/dataframe.css" type="text/css" />
        <link rel="stylesheet" href="static/extensions/panel/css/json.css" type="text/css" />
        <link rel="stylesheet" href="static/extensions/panel/css/loading.css" type="text/css" />
        <link rel="stylesheet" href="static/extensions/panel/css/markdown.css" type="text/css" />
        <link rel="stylesheet" href="static/extensions/panel/css/widgets.css" type="text/css" />
        <style>
            
                    .bk.pn-loading.arcs:before {
...
1 Like

Hi @ahuang11

You can do this in minimum 4 ways.

  • a custom template just returning json
  • a rest api (yes, panel supports this)
  • a static page just returning json
  • a custom tornado handler

For someone with no web dev experience, all dependent on panel, can you share an example with a static page / rest api (those sound the simplest)?

to be fair, id assume that panel is not the right tool for a simple api endpoint, and that there are better options for that :slight_smile:

I guess so, but I already had an app, but with status checks, it used up too much resources, so I added an endpoint with
panel serve main_app/ main_app/status.py

1 Like