Assigns the variables to `dash.page_registry` as an `OrderedDict` (ordered by `order`). `dash.page_registry` is used by `pages_plugin` to set up the layouts as a multi-page Dash app. This includes the URL routing callbacks (using `dcc.Location`) and the HTML templates to includ
(
module,
path=None,
path_template=None,
name=None,
order=None,
title=None,
description=None,
image=None,
image_url=None,
redirect_from=None,
layout=None,
**kwargs,
)
| 157 | |
| 158 | |
| 159 | def register_page( |
| 160 | module, |
| 161 | path=None, |
| 162 | path_template=None, |
| 163 | name=None, |
| 164 | order=None, |
| 165 | title=None, |
| 166 | description=None, |
| 167 | image=None, |
| 168 | image_url=None, |
| 169 | redirect_from=None, |
| 170 | layout=None, |
| 171 | **kwargs, |
| 172 | ): |
| 173 | """ |
| 174 | Assigns the variables to `dash.page_registry` as an `OrderedDict` |
| 175 | (ordered by `order`). |
| 176 | |
| 177 | `dash.page_registry` is used by `pages_plugin` to set up the layouts as |
| 178 | a multi-page Dash app. This includes the URL routing callbacks |
| 179 | (using `dcc.Location`) and the HTML templates to include title, |
| 180 | meta description, and the meta description image. |
| 181 | |
| 182 | `dash.page_registry` can also be used by Dash developers to create the |
| 183 | page navigation links or by template authors. |
| 184 | |
| 185 | - `module`: |
| 186 | The module path where this page's `layout` is defined. Often `__name__`. |
| 187 | |
| 188 | - `path`: |
| 189 | URL Path, e.g. `/` or `/home-page`. |
| 190 | If not supplied, will be inferred from the `path_template` or `module`, |
| 191 | e.g. based on path_template: `/asset/<asset_id` to `/asset/none` |
| 192 | e.g. based on module: `pages.weekly_analytics` to `/weekly-analytics` |
| 193 | |
| 194 | - `relative_path`: |
| 195 | The path with `requests_pathname_prefix` prefixed before it. |
| 196 | Use this path when specifying local URL paths that will work |
| 197 | in environments regardless of what `requests_pathname_prefix` is. |
| 198 | In some deployment environments, like Dash Enterprise, |
| 199 | `requests_pathname_prefix` is set to the application name, |
| 200 | e.g. `my-dash-app`. |
| 201 | When working locally, `requests_pathname_prefix` might be unset and |
| 202 | so a relative URL like `/page-2` can just be `/page-2`. |
| 203 | However, when the app is deployed to a URL like `/my-dash-app`, then |
| 204 | `relative_path` will be `/my-dash-app/page-2`. |
| 205 | |
| 206 | - `path_template`: |
| 207 | Add variables to a URL by marking sections with <variable_name>. The layout function |
| 208 | then receives the <variable_name> as a keyword argument. |
| 209 | e.g. path_template= "/asset/<asset_id>" |
| 210 | then if pathname in browser is "/assets/a100" then layout will receive **{"asset_id":"a100"} |
| 211 | |
| 212 | - `name`: |
| 213 | The name of the link. |
| 214 | If not supplied, will be inferred from `module`, |
| 215 | e.g. `pages.weekly_analytics` to `Weekly analytics` |
| 216 |
searching dependent graphs…