Dash Pages with optional Variable Path

I am exploring the documentation, and more importantly playing with the dash-multi-page-app-demos examples which are a tremendous resource. My question is can a Variable path argument be optional? I have a /stocks page with a dropdown menu to select the stock, and if you call /stocks/ I would like that auto-loaded as the value within the dcc.Dropdown. How I manage that is besides the point. From what I see if you define path_template=“/stocks/” then it 404’s without a stock defined and if you didn’t define path_template it will 404 with the stock defined. Can the arg be optional and work both ways?

@marketemp

If you define a path variable, it can’t be options. However, you could define what to do if the path variable was “none”

1 Like