django怎么引用echarts

這篇文章主要講解了“django怎么引用echarts”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“django怎么引用echarts”吧!

創(chuàng)新互聯(lián),專注為中小企業(yè)提供官網(wǎng)建設(shè)、營(yíng)銷型網(wǎng)站制作、響應(yīng)式網(wǎng)站開發(fā)、展示型成都網(wǎng)站建設(shè)、成都網(wǎng)站制作等服務(wù),幫助中小企業(yè)通過(guò)網(wǎng)站體現(xiàn)價(jià)值、有效益。幫助企業(yè)快速建站、解決網(wǎng)站建設(shè)與網(wǎng)站營(yíng)銷推廣問(wèn)題。

如果大家想用django架構(gòu)來(lái)制作報(bào)表平臺(tái),可以使用django+echarts

具體如何引入echarts,如下:

1、新建項(xiàng)目 django_report

django-admin.py startproject django_report

2、新建app report01

python manage.py startapp report01

3、建立目錄

cd /chunlei/django/django_report/

mkdir static

mkdir static/js

mkdir static/css

mkdir static/images

cd /chunlei/django/django_report/report01

mkdir templates

mkdir templates/report01_test

4、設(shè)置配置

cd /chunlei/django/django_report/django_report

vi settings.py

STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static').replace('\\', '/')

STATICFILES_DIRS = (

    ('css', os.path.join(STATIC_ROOT, 'css').replace('\\', '/')),

    ('js', os.path.join(STATIC_ROOT, 'js').replace('\\', '/')),

    ('images', os.path.join(STATIC_ROOT, 'images').replace('\\', '/')),

)

TIME_ZONE = 'Asia/Shanghai'

TEMPLATES = [

    {

        'BACKEND': 'django.template.backends.django.DjangoTemplates',

        'DIRS': ['/chunlei/chunlei/django/django_report/django_report/templates'],

        'APP_DIRS': True,

        'OPTIONS': {

            'context_processors': [

                'django.template.context_processors.debug',

                'django.template.context_processors.request',

                'django.contrib.auth.context_processors.auth',

                'django.contrib.messages.context_processors.messages',

            ],

        },

    },

]

INSTALLED_APPS = [

    'django.contrib.admin',

    'django.contrib.auth',

    'django.contrib.contenttypes',

    'django.contrib.sessions',

    'django.contrib.messages',

    'django.contrib.staticfiles',

   'report01',

]

ALLOWED_HOSTS = ['*']

5、上傳echarts

下載

http://echarts.baidu.com/download.html

將下載的echarts.js 上傳到 /chunlei/django/django_report/static/js/ 目錄

6、url設(shè)置

cd /chunlei/django/django_report/django_report

vi urls.py

from django.conf.urls import url

from django.contrib import admin

from report01 import views as report01view

urlpatterns = [

    url(r'^report01/zhexian$',report01view.zhexian,name='zhexian'),

]

7、views.py設(shè)置

cd /chunlei/django/django_report/report01

vi views.py

from django.shortcuts import render

from django.shortcuts import render_to_response

from django.http import HttpResponse

def zhexian(request):

    return render_to_response('report01_test/zhexian.html')

8、測(cè)試網(wǎng)頁(yè)配置

cd /chunlei/django/django_report/report01/templates/report01_test
vi zhexian.html

<head>

    <meta charset="utf-8">

    <title>ECharts</title>

    <!-- 引入 echarts.js -->

     <script type="text/javascript" src="/static/js/echarts.js"></script>

</head>

注:其他內(nèi)容就不寫出了,可以自由下載進(jìn)行測(cè)試

9、開啟

cd /chunlei/django/django_report

python manage.py  runserver IP:PORT

10、測(cè)試

http://IP:PORT/report01/zhexian

django怎么引用echarts

感謝各位的閱讀,以上就是“django怎么引用echarts”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)django怎么引用echarts這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

分享題目:django怎么引用echarts
本文鏈接:http://muchs.cn/article44/gescee.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、品牌網(wǎng)站設(shè)計(jì)、搜索引擎優(yōu)化、企業(yè)建站、響應(yīng)式網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)