Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does django quote echarts?

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how django quotes echarts". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it slowly to study and learn "how django quotes echarts" together!

If you want to use django architecture to make report platform, you can use django+echarts

How to introduce echarts is as follows:

1. New project django_report

django-admin.py startproject django_report

2. New app report01

python manage.py startapp report01

3. Create a directory

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. Setting configuration

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. Upload echarts

download

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

The requested URL/static/js/jquery.js was not found on this server.

6, url settings

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 Settings

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. Test web page configuration

cd /chunlei/django/django_report/report01/templates/report01_test

vi zhexian.html

ECharts

Note: Other content will not be written, you can freely download for testing

9, open

cd /chunlei/django/django_report

python manage.py runserver IP:PORT

10. Testing

http://IP:PORT/report01/zhexian

Thank you for reading, the above is the content of "how django quotes echarts". After studying this article, I believe everyone has a deeper understanding of how django quotes echarts. The specific use situation still needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report