GithubHelp home page GithubHelp logo

Comments (13)

eddy-ojb avatar eddy-ojb commented on May 8, 2024 1

I've gone ahead and implemented this feature and it works for me, though its not a clean solution yet. You are right that there are some issues with injecting Dash in to an existing page, but I think these look resolvable.

I am still experimenting to see what is better in what scenario and learning how the dpd code works.

The iframe route might be fine but some handy options would be:

  • Being able to choose whether to return raw html code for injection or an iframe
  • If an iframe, passing specific css routes over to Dash during construction of the app would minimise duplication. For example, I am thinking that if we know the Django app name and the base url and the css we care about, it might be suitable to pass the same static routes over to DjangoDash to inject in the dpd template containing the iframe.

from django-plotly-dash.

eddy-ojb avatar eddy-ojb commented on May 8, 2024 1

Hi delsim,

I am on holiday without my computer but when I'm back in a week and a half I'll neaten my code and share!

from django-plotly-dash.

GibbsConsulting avatar GibbsConsulting commented on May 8, 2024 1

I've merged your pull request into a new branch off of the 0.6.0 tag. I'll use this as a base for pulling in parts of your changeset to trunk. It is not clear if this is the best workflow with git/github but it should work here.

from django-plotly-dash.

delsim avatar delsim commented on May 8, 2024

The iframe is used because the dash content doesn't mix well with other content on the page. This makes not encapsulating it tricky.
Would a different template - one that still had an iframe, but had some css (and perhaps js) added to it - suffice?

from django-plotly-dash.

delsim avatar delsim commented on May 8, 2024

I've done some work to move this project onto a newer dash version, so we now have the benefit of the new template rendering in dash and I'm starting to think about how to leverage that to make the iframe optional.

@eddy-ojb - are you able to share any ideas or code from your own work? I'm keen to avoid duplicating work, particularly if it helps me avoid trampling on what you've already done.

from django-plotly-dash.

eddy-ojb avatar eddy-ojb commented on May 8, 2024

The code is on its way shortly.

Whilst I have integrated my changes to the DPD code to show how I made this work, I won't be offended if you refine it as I don't have a mental map of how it all connects just yet. The way Django and Dash work is so different that I feel that I need to get stuck in to React and Flask to fully realize the DPD code.

I just need to scrub my demo and then push my version of the DPD code and a demo to a repo. Bearing in mind that I am not an expert in Git, would you like me to try pushing to your repo or shall I push to my own and you compare that way?

from django-plotly-dash.

delsim avatar delsim commented on May 8, 2024

I wouldnt claim to be a git expert either! I think push to your repo, then send a pull request, is the best/easiest way forward.

from django-plotly-dash.

eddy-ojb avatar eddy-ojb commented on May 8, 2024

I've made the request - I did try over the weekend but got quite frustrated with Git! This is my first push like this so not offended if you chop, change or reject. We will be sticking to this methodology for now though until we get our head around channels and how we can deploy with reverse proxy on IIS, then I would like to move on to your channels methodology.

from django-plotly-dash.

eddy-ojb avatar eddy-ojb commented on May 8, 2024

The clean_dash_content function that I wrote in views.py in my branch can be replaced by the following:

dash_content = "".join(dash_content.decode('unicode_escape').splitlines())

Works across the different versions I have tested.

from django-plotly-dash.

eddy-ojb avatar eddy-ojb commented on May 8, 2024

I have tested my html return vs the iframe method for a larger layout with callbacks and the load time is nearly 2:1. The iframe method is superior in this case.

I have noticed the 'html_formation' branch has been developed with some probably much more efficient code. I am happy to give this a test if/when it is ready - wondering if the load ratios are similar. If this runs reasonably, this still seems like a nice option as I find duplicating the static routes with Dash offline tricky at the moment, unless I am doing it incorrectly.

from django-plotly-dash.

GibbsConsulting avatar GibbsConsulting commented on May 8, 2024

html formation (along with a replication of the example kindly supplied by @eddy-ojb) directly into a template, so not wrapped in an iframe, is now in the published prerelease 0.8.0 version and it covers (I think) the goal of this enhancement request.

As a consequence, closing this issue. If its way off base then please reopen and comment. If there are bugs etc then please open a new issue.

from django-plotly-dash.

eddy-ojb avatar eddy-ojb commented on May 8, 2024

@GibbsConsulting, once a project is setup to accommodate this feature, I have it found it works really well! Thanks!

from django-plotly-dash.

GibbsConsulting avatar GibbsConsulting commented on May 8, 2024

@eddy-ojb that's good to know, thanks!

from django-plotly-dash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.