self.add_error_handler(Exception, self.print_exception)
def get_hubapp_by_name(self, name):
- if name == "root":
- name = ""
return self.hubapps[name]
async def print_exception(self, req, resp, ex, params):
host = f"{host}:{port}"
app = config.loaded_app.app
print("Secret:", app.secret)
- for key, value in app.root_app.files_per_uris.items():
+ for key, value in app.hubapps["root"].files_per_uris.items():
if Path(value.path.name).stem == "index.html":
url = urlunsplit((protocol_name, host, key, "", ""))
print("URL:", url)
elif uri_tail == "index.html":
uri_tail = ""
name = self.name
+ if name == "root":
+ name = ""
if name and uri_tail:
name = f"{name}/"
return f"/{name}{uri_tail}"
SCAN_FILES_RECURSIVELY = False
def __init__(self, app, base_dir):
- super().__init__(app, base_dir, "")
+ super().__init__(app, base_dir, "root")
@staticmethod
def is_master_uri(uri_tail):
<!-- <link rel="stylesheet" href="{% static 'style.css' %}"> -->
</head>
<body>
- <script src="{% static 'common.js' %}"></script>
+ <script src="{% static 'common.js', 'root' %}"></script>
<script type="text/javascript">
var ws_uri = "{% static 'ws_client' %}";
</script>
<!-- <link rel="stylesheet" href="{% static 'style.css' %}"> -->
</head>
<body>
- <script src="{% static 'common.js' %}"></script>
+ <script src="{% static 'common.js', 'root' %}"></script>
<script type="text/javascript">
var ws_uri = "{% static 'ws_master' %}";
</script>
<body>
<h1>App list</h1>
<ul>
- {% for hubapp in hubapp.app.hubapps %}
- <li>
- <span>{{ hubapp.name }}</span>
- <span><a href="{% static 'master.html', hubapp %}">master</a></span>
- <span><a href="/{{ hubapp.name }}">/{{ hubapp.name }}</a></span>
- </li>
+ {% for name, hubapp in hubapp.app.hubapps.items() %}
+ {% if name != 'root' %}
+ <li>
+ <span>{{ name }}</span>
+ <span><a href="{% static 'master.html', hubapp %}">master</a></span>
+ <span><a href="/{{ name }}">/{{ name }}</a></span>
+ </li>
+ {% endif %}{# name != 'root' #}
{% endfor %}{# hubapps #}
</ul>
</body>