简体   繁体   English

使用python flask应用程序在heroku上未显示highcharts

[英]highcharts not showing on heroku using python flask app

i have created an html which visualizes some data using highcharts. 我创建了一个html,可以使用highcharts可视化一些数据。 When using this html on localhost i can successfully see my charts. 本地主机上使用此html时,我可以成功查看我的图表。 But when i use it on heroku i do not get my charts. 但是当我在heroku上使用它时,我没有得到图表。 Any ideas? 有任何想法吗?

 <!DOCTYPE html> <html> <base href="https://www.highcharts.com" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src="/lib/jquery-1.7.2.js" type="text/javascript"></script> <script type="text/javascript"> </head> <body > <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <script src="https://code.highcharts.com/modules/data.js"></script> <script src="https://code.highcharts.com/modules/drilldown.js"></script> <!--<div id="container" style="min-width: 310px; height: 0 auto; max-width: 600px; margin: 0 auto"></div>--> <!--<div id="container2" style="min-width: 310px; height: 0 auto; max-width: 600px; margin: 0 auto"></div>--> <div id="container6" class="text"> <p>info:about,category,location,website,founded</p> </div> <div id="container" class="chart"> <p></p> </div> <div id="container2" class="chart"> <p></p> </div> <div id="container3" class="chart"> <p></p> </div> <div id="container4" class="chart"> <p></p> </div> <div id="container5" class="chart"> </div> <div id="container7" class="chart"> <p>post message,video,photo etc.</p> </div> </body> </html> 

i tried several solutions like copying the modules locally or impose https: insted of http: on the links. 我尝试了几种解决方案,例如在本地复制模块或在链接上加上HTTP:的https:。 I suppose that the issue has to do about loading the highcharts .js but i cannot figure why 我想这个问题与加载highcharts .js有关,但我不知道为什么

A few things that I noticed and corrected: 我注意到并更正的几件事:

  • Your code snippet did not have a starting <head> tag. 您的代码段没有开始的<head>标记。
  • You had an unclosed instance of <script type="text/javascript"> right before your </head> tag. </head>标记之前,您有一个<script type="text/javascript">未关闭的实例。 This was causing an Uncaught SyntaxError: Unexpected token < error. 这导致了Uncaught SyntaxError: Unexpected token <错误。
  • I moved all of your script calls in between the <head> tags and gave the jQuery library an absolute URL (in order to get this to work in the snippet). 我将所有脚本调用都移到了<head>标记之间,并为jQuery库提供了绝对URL(以使其在代码段中起作用)。

When you run the code snippet now, you'll see the expected text in the <p> tags. 现在运行代码段时,您会在<p>标记中看到预期的文本。 I don't see a chart, but I also don't see the code with the options to create them. 我没有看到图表,但是也没有看到带有创建它们的选项的代码。

An edited version of your code snippet is below. 您的代码段的编辑版本如下。

I hope this is helpful for you. 希望对您有帮助。

 <!DOCTYPE html> <html> <head> <base href="https://www.highcharts.com" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <!-- <script src="/lib/jquery-1.7.2.js" type="text/javascript"></script> --> <script src="https://code.jquery.com/jquery-1.7.2.js" type="text/javascript"></script> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <script src="https://code.highcharts.com/modules/data.js"></script> <script src="https://code.highcharts.com/modules/drilldown.js"></script> </head> <body > <!--<div id="container" style="min-width: 310px; height: 0 auto; max-width: 600px; margin: 0 auto"></div>--> <!--<div id="container2" style="min-width: 310px; height: 0 auto; max-width: 600px; margin: 0 auto"></div>--> <div id="container6" class="text"> <p>info:about,category,location,website,founded</p> </div> <div id="container" class="chart"> <p></p> </div> <div id="container2" class="chart"> <p></p> </div> <div id="container3" class="chart"> <p></p> </div> <div id="container4" class="chart"> <p></p> </div> <div id="container5" class="chart"> </div> <div id="container7" class="chart"> <p>post message,video,photo etc.</p> </div> </body> </html> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM