[英]Django-Dashing Custom Widget HTML Location
I'm using the Django-Dashing framework ( https://github.com/talpor/django-dashing ), and I can't figure out where to place my HTML file for the custom widget that I am using. 我正在使用Django-Dashing框架( https://github.com/talpor/django-dashing ),但我不知道将HTML文件放置在我正在使用的自定义小部件中的位置。
I have the following code in my dashboard.html
file, which is being loaded properly. 我的
dashboard.html
文件中包含以下代码,该文件已正确加载。
{% extends 'dashing/base.html' %}
{% load staticfiles %}
{% block stylesheets %}
<link rel="stylesheet" href="{% static '../../static/widgets/timetables/timetables.css' %}">
<!--<link rel="stylesheet" href="{% static '../../../../static/css/analytics/widgets/timetables.css' %}">-->
{% endblock %}
{% block scripts %}
<script type="text/javascript" src="{% static '../../static/widgets/timetables/timetables.js' %}"></script>
<!--<script type="text/javascript" src="{% static '../../../../static/js/analytics/widgets/timetables.js' %}"></script>-->
{% endblock %}
{% block config_file %}
<script type="text/javascript" src="{% static '../../static/dashing-config.js' %}"></script>
<!--<script type="text/javascript" src="{% static '../../../../static/js/analytics/dashing-config.js' %}"></script>-->
{% endblock %}
I also believe I properly defined my TimetablesWidget
class properly in widgets.py
, and its corresponding JavaScript class name Timetables
properly, as all of the data is being correctly fetched when the widget renders. 我也相信我已经在
widgets.py
正确定义了TimetablesWidget
类,并正确地定义了其对应的JavaScript类名称Timetables
,因为在渲染窗口小部件时正确地获取了所有数据。
I did a console.log
statement to make sure that the data was being fetched properly, and it indeed is. 我做了一个
console.log
语句,以确保正确地获取了数据,的确如此。 However, it is not rendering correctly in the div
on the screen, which makes me think that my timetables.html
file is not actually being loaded. 但是,它无法在屏幕上的
div
正确呈现,这使我认为我的timetables.html
文件并未真正加载。
Based on where I defined my other paths, could someone let me know where I am supposed to put my HTML file, or perhaps correct me if I am doing something else wrong? 根据我定义其他路径的位置,有人可以让我知道应该将HTML文件放置在什么地方,或者如果我做错了其他事情,还可以纠正我吗?
Thanks in advance! 提前致谢!
You can static file feature of Django 您可以使用Django的静态文件功能
https://docs.djangoproject.com/en/1.11/howto/static-files/ https://docs.djangoproject.com/en/1.11/howto/static-files/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.