# Embed a Dash app in Genie.jl website

**URL:** <https://discourse.julialang.org/t/embed-a-dash-app-in-genie-jl-website/56616>\
**Category:** Web Stack\
**Created:** [March 6, 2021, 1:30pm UTC](https://discourse.julialang.org/t/embed-a-dash-app-in-genie-jl-website/56616 "2021-03-06T13:30:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MLackner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mlackner/32/2789_2.png) [@MLackner](https://discourse.julialang.org/u/MLackner)\
**Post date:** [March 6, 2021, 1:30pm UTC](https://discourse.julialang.org/t/embed-a-dash-app-in-genie-jl-website/56616/1 "2021-03-06T13:30:44Z")

</div>

Hi!

I’m trying to embed a `Dash.jl` app in a website that is generated by `Genie.jl`.

My approach is working with `Stipple.jl` apps but unfortunately, due to the lack of documentation I’m not able to do something useful with it 😖. This is why I want to use `Dash.jl`.

My approach with `Stipple.jl` is as follows:

In the `MyController.jl` file I have a slightly modified version of the `HelloStipple` example

```julia
# MyController.jl
module MyController

using Genie, Genie.Renderer.Html, Stipple

Base.@kwdef mutable struct Name <: ReactiveModel
  name::R{String} = "World!"
end

global MODEL = Stipple.init(Name())

function ui()
  [
    page(
      vm(MODEL), class="container", title="Hello Stipple",
      [
        h1([
          "Hello, "
          span("", @text(:name))
        ])

        p([
          "What is your name? "
          input("", placeholder="Type your name", @bind(:name))
        ])
      ]
    )
  ] |> html
end

function _ui() 
  html_str = String(ui().body)
  html(:scales, :ui; ui=html_str)
end

end

```

With the `_ui()` function I send the HTML string to the view file in `resourches/my/views/ui.jl.html` which simply looks like this:

```julia
<% ui %>

```

And for completeness the `routes.jl` file:

```julia
# routes.jl
using Genie.Router, MyController

route("/", MyController._ui)

```

Now I suppose to make it work with `Dash.jl` I have to somehow get the proper HTML string from my app. The problem is I can’t figure out how to do this. Searching for how to embed a Dash app into a website I found this solution for Python/Flask:

```python
server = Flask( __name__ )
app = dash.Dash( __name__ , server=server, url_base_pathname='/dummypath')
app.layout = <setup your Dash app here>

@server.route("/dash")
def MyDashApp():
    return app.index()

```

So, if I interpret that correctly, `app.index()` returns the HTML in this case. Problem is, I can’t find a Julia equivalent to the `app.index()` method.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [April 19, 2021, 5:05pm UTC](https://discourse.julialang.org/t/embed-a-dash-app-in-genie-jl-website/56616/2 "2021-04-19T17:05:58Z")

</div>

Why do you want Dash.jl in a Genie.jl website? It’s not a requirement for Dash at least, nor am I sure it’s supported (by either). Generally Julia packages compose very well, so I’m a bit curious if it works here too, but Dash already has Flask-equivalent component dependency, so I’m just pointing out in case you’re on the wrong path.
