Comments (7)
@hkhare42 did you add the middleware entry as mentioned in the tag documentation?
from django-plotly-dash.
@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.
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:
In case of IFrame, it gets it from this URL:
Even though the links within the IFrame look similar to direct case:
Console Log for IFrame version:
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.
@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.
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.
@GibbsConsulting @delsim Looking forward to your guidance and suggestions.
from django-plotly-dash.
@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)
- allow_duplicate on outputs doesn't work HOT 7
- Using dash_leaflet causes js library to fail HOT 9
- Using dash-tradingview dash_tvlwc breaks the app in Django HOT 2
- Improve configuration documentation
- How to pass multiple pandas Time Series (created in Django view) to Dash callback? HOT 2
- allow_duplicate output fails silently
- Bootstrap 5 incompatibility
- How to make Playable Gifs for Django Dash? HOT 1
- AttributeError: 'function' object has no attribute 'expanded' HOT 4
- Enable get_asset_url to be used for file names passed to the DjangoDash constructor
- Support for Django 5.0 HOT 5
- plotly_direct tag overwrites template style set in base.html HOT 3
- Enable use on Django 5.0
- Increase dash version to 2.10 or greater HOT 3
- Dash Vega Components HOT 1
- Update documentation to refer to bootstrap 5
- plotly_direct HOT 4
- returning data from plotly to django HOT 1
- How to query database and pass it to the `plotly_app` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-plotly-dash.