自学内容网 自学内容网

django结合smartchart实现系统的数据看板页面

1、安装smartchart 

pip3 install smartchart 

2、在你的setting.py的INSTALL_APPS中加入’smart_chart.echart'

3、MIDDLEWARE 中注释掉XFrameOptionsMiddleware

4、检查确保在Templates的设定处有DIRS的相关设定

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR / 'templates'],   #此处需要有
        'APP_DIRS': True,   #也要有
        .....
    },
]

5、setting.py中设定为中国时区

LANGUAGE_CODE = 'zh-hans'
    TIME_ZONE = 'Asia/Shanghai'
    USE_I18N = True
    USE_L10N = True
    USE_TZ = False  # 此处必须为False

6、url.py中加入引用

from django.conf.urls import include
    from django.views.generic import RedirectView

注意,如果原来已有from django.urls import include ,则注意新的引用可以写为:

from django.conf.urls import include as inclu

url.py的urlp


原文地址:https://blog.csdn.net/symstandsun/article/details/138122764

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!