# Embed dash plot into web page

**URL:** <https://community.plotly.com/t/embed-dash-plot-into-web-page/5337>\
**Category:** Dash Python\
**Created:** [August 10, 2017, 3:10pm UTC](https://community.plotly.com/t/embed-dash-plot-into-web-page/5337 "2017-08-10T15:10:11Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![ead](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@ead](https://community.plotly.com/u/ead)\
**Post date:** [August 11, 2017, 1:31am UTC](https://community.plotly.com/t/embed-dash-plot-into-web-page/5337/3 "2017-08-11T01:31:31Z")

</div>

I’ve been asked if I can add Dash to Django-based website without iframe, so I did this:

1. added `dash-index` view, which renders html page, copied from Dash main page (will be styled as website)
2. added `view` for all requests, started with ‘\_dash’, with code:

```auto
    return HttpResponse(dispatcher(request), content_type='application/json')

```

1. where dispatcher looks like this:

```auto
app = _create_app() # create usual Dash app
# request is Django HttpRequest
params = {
    'data': request.body,
    'method': request.method,
    'content_type': request.content_type
}
with app.server.test_request_context(request.path, **params):
    app.server.preprocess_request()
    try:
        response = app.server.full_dispatch_request()
    except Exception as e:
        response = app.server.make_response(app.server.handle_exception(e))
    return response.get_data()

```

I know this is not an ideal solution, but it works and does the job for now.

---

_[View the full topic](https://community.plotly.com/t/embed-dash-plot-into-web-page/5337)._
