Get the App
SLTechnology News&Howtos  ›  Database  › 

How does django quote echarts?

Shulou Source: shulou.com Published: 2022-05-31 18:55:49 10月04日 Update

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!

Tags: Content learning testing catalog configuration freedom that is platform ideas situations reports articles more architecture knowledge knowledge points articles web pages follow questions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Xiaomi Microsoft Apple Shulou Information