Hi @isaamarod
Yes, as @jlfsjunior mentioned, it’s possible to make an app like this with Dash, and it’s much, much easier with Dash than in the blog post you linked to, especially if you use the new /pages
feature.
In the blog, they use flask to render a page template that uses the Jinja2 template engine as described here. With Dash, the “template” is the page layout
. If you make the layout
a function, then you can pass variables to it from the URL using query strings - or as path variables.
For example:
if the URL is: (query string)
http://127.0.0.1:8050/dashboard?lang=french
or a path variable:
http://127.0.0.1:8050/dashboard/french
the language parameter will be passed to the layout - for example:
def layout(lang="english", **other_unknown_query_strings):
translate = {"english": {"greeting":"hello"}, "french": {"greeting": "bonjour"}}
return html.Div(translate[lang]["greeting"])
This example will render:
bonjour
If no language is specified, it will show the default english greeting of “hello”