Coder Social home page Coder Social logo

Comments (7)

GibbsConsulting avatar GibbsConsulting commented on June 9, 2024 1

@hkhare42 did you add the middleware entry as mentioned in the tag documentation?

from django-plotly-dash.

GibbsConsulting avatar GibbsConsulting commented on June 9, 2024

@hkhare42 are you able to look in the browser developer tools window and see what URLs it is requesting, and how they vary between the normal and direct case? Also, are there any warnings or errors in the console output?

As a rule, the direct template tag variant is a bit more of a pain as you lose the isolation and compartmentalisation of the iframe. Is there a particular reason that you need to use it?

Nice app, btw. Is it, or will it be, available at a public URL?

from django-plotly-dash.

hkhare42 avatar hkhare42 commented on June 9, 2024

thanks! the iframe version of the app is live here: https://www.datadabble.in/2018-fifa-mens-wc-explorer/

I do have the middleware entry added as well as per documentation.


URLs it is trying to access for the plotly_direct version:

image

image


In case of IFrame, it gets it from this URL:

image

Even though the links within the IFrame look similar to direct case:
image


Console Log for IFrame version:

image


The only issue I have with the IFrame version is that I have to provide an aspect ratio before hand and that doesn't change dynamically with screen size. My app.css uses vw and vh units to ensure that the width and height exactly fits the user window. So, I was wondering if the plotly_direct route could get me there.

from django-plotly-dash.

delsim avatar delsim commented on June 9, 2024

@hkhare42 I think you need to wrap them in calls to app.get_asset_url as noted in passing here but unfortunately you can't do that in the constructor of app.
Can you use the vw and vh values somehow in the plotly_app template tag or change the html by overriding the actual template itself by creating a file in your Django TEMPLATES path ahead of the django-plotly-dash one?

from django-plotly-dash.

hkhare42 avatar hkhare42 commented on June 9, 2024

I'm wary about breaking something by trying to override the template themselves. Let me try that as last resort. For now:


For the plotly_app approach, tried:
{%plotly_app name="SimpleExample" dstyle="padding-bottom: 0; height: 100vh;" %}

Got a 500 error. Probably not the right way to try passing something to dstyle. (https://github.com/GibbsConsulting/django-plotly-dash/blob/master/django_plotly_dash/templates/django_plotly_dash/plotly_app.html)


For the plotly_direct suggestion, i.e. the app.get_asset_url method, I tried to add it to the body of the app like so:

app.layout = html.Div(id='bodydiv', children = [
                    html.Link(rel='stylesheet', href=app.get_asset_url('app_css.css')),
                    ... 

But the app is still looking in the same place and unable to fetch:
Refused to apply style from 'http://127.0.0.1:8000/app1/assets/app_css.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

from django-plotly-dash.

hkhare42 avatar hkhare42 commented on June 9, 2024

@GibbsConsulting @delsim Looking forward to your guidance and suggestions.

from django-plotly-dash.

GibbsConsulting avatar GibbsConsulting commented on June 9, 2024

@hkhare42 did you try overriding the templates? If they are in your Django app's templates directory structure and your app is ahead of dpd in the list of Django apps, then your version of the template will be used ahead of the dpd one.

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.