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