Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
741 views
in Technique[技术] by (71.8m points)

django - Loading a plotly dash app into html leave huge empty space at the bottom

I am trying to load a django-plotly-dash app onto a page in my django project, where I am building the pages using standard bootstrap components and css. However I am unsure why the dash app always creates a huge empty space below it, and was wondering if anyone has encountered a similar issue and has found a way around it.

Thanks in advace

Jason

dashboard.py

import dash
import dash_html_components as html
from django_plotly_dash import DjangoDash
import plotly.express as px
import pandas as pd

import dash_core_components as dcc
import dash_bootstrap_components as dbc
external_stylesheets = ['dbc.themes.BOOTSTRAP']

app = DjangoDash('Example')

# Define the app
app.layout = html.Div(children=[
                html.Div(className='row',  # Define the row element
                        children=[

                            html.Div(className='four columns',
                                # style=fourColumnStyle,
                                children = [
                                    html.H2('Dash - TEST', style = {'color' : 'Azure'}),
                                    html.P('''Testing for empty space for Plotly - Dash''', style = {'color' : 'LightGrey'}),
                                ]
                                )
                            ])
                        ])

index.html

<!-- Load CSS -->
{% load static %}

<!DOCTYPE html>
<html lang="en">

<head>

  <!-- Custom fonts for this template-->
  <link href="{% static 'vendor/fontawesome-free/css/all.min.css' %}" rel="stylesheet" type="text/css">

  <!-- Custom styles for this template-->
  <link href="https://stackpath.bootstrapcdn.com/bootswatch/4.5.2/solar/bootstrap.min.css" rel="stylesheet">

</head>

<body id="page-top">

  <div id="wrapper">

    <div id="content-wrapper">

      <div class="container-fluid">
        {%load plotly_dash%}
        {% plotly_app name='Example' ratio=1 %}}
        <div>This is a test</div>
      </div>
      <!-- /.container-fluid -->

    </div>
    <!-- /.content-wrapper -->

  </div>
  <!-- /#wrapper -->

    <!-- Bootstrap core JavaScript-->
    <script src="{% static 'vendor/jquery/jquery.min.js' %}"></script>
    <script src="{% static 'vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script>
  
    <!-- Core plugin JavaScript-->
    <script src="{% static 'vendor/jquery-easing/jquery.easing.min.js' %}"></script>
  
    <!-- Custom scripts for all pages-->
    <script src="{% static 'js/sb-admin.min.js' %}"></script>

</body>
</html>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...