Case sensitivity in multi page app locations

The following multi-page app works just fine.

import dash
from dash import Dash, html, dcc

layout_1 = html.Div([
	html.H1('The Page 1 Title'),
	dcc.Link('Go to Page 2', href='/page-2')

layout_2 = html.Div([
	html.H1('The Page 2 Title'),
	dcc.Link('Go to Page 1', href='/')

app = Dash( __name__, use_pages=True, pages_folder='')

dash.register_page("page-1", path='/', layout=layout_1)
dash.register_page("page-2", layout=layout_2)

app.layout = html.Div( dash.page_container )

if __name__ == '__main__':

However, if I capitalize page-2 to Page-2 in both locations it results in an error 404 page not found. Looking further, it appears register_page passes the module argument to an _infer_path function which does some string cleaning (e.g., lower case, replace _ with -).

I know capital letters are a bit odd in this context, but I had a student with this issue and it was a PITA to solve. I know it is also possible to manually set the path in register_page with the path= argument — dash.register_page("Page-2", path="Page-2", layout=layout_2) — but is that really the desired behavior? If so, should it be mentioned in the docs somewhere? Am I missing something?

Thanks in advance!

Hi @tyson and welcome to the Dash community :slightly_smiling_face:

This is a good question!

You can find the reference for dash.register_page here in the dash docs:

You can also see it in your python console:

import dash

You will see there are several paramaters that are inferred for your convienence, based on common practices. This reduces the amount of boilerplate code you need to write. It’s possible to override them if those defaults don’t work for you. The code you provided is a good example of how to do that.