Skip to content

Commit

Permalink
更新django==4.0,停止python3.7支持
Browse files Browse the repository at this point in the history
upgrade djangorestframework-simplejwt==5.2.0
upgrade pyecharts==1.9.1
  • Loading branch information
hhyo committed Jun 4, 2022
1 parent 872c551 commit 878bdd9
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.8, 3.9, 3.10.0]

# https://github.com/actions/example-services/tree/master/.github/workflows
services:
Expand Down
5 changes: 4 additions & 1 deletion archery/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@
}
}

# https://docs.djangoproject.com/en/3.2/ref/settings/#std-setting-DEFAULT_AUTO_FIELD
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'

# API Framework
REST_FRAMEWORK = {
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
Expand Down Expand Up @@ -311,4 +314,4 @@

PKEY_ROOT = os.path.join(MEDIA_ROOT, 'keys')
if not os.path.exists(PKEY_ROOT):
os.mkdir(PKEY_ROOT)
os.mkdir(PKEY_ROOT)
10 changes: 5 additions & 5 deletions common/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def pyecharts(request):
orient="vertical", pos_top="15%", pos_left="2%", is_show=False
))
pie1.set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"))
pie1.add("", [list(z) for z in zip(attr, value)])
pie1.add("", [list(z) for z in zip(attr, value)]) if attr and data else None

# 工单按人统计
data = chart_dao.workflow_by_user(30)
Expand All @@ -61,7 +61,7 @@ def pyecharts(request):
orient="vertical", pos_top="15%", pos_left="2%"
))
pie2.set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"))
pie2.add("", [list(z) for z in zip(attr, value)])
pie2.add("", [list(z) for z in zip(attr, value)]) if attr and data else None

# SQL查询统计(每日检索行数)
attr = chart_dao.get_date_list(one_month_before, today)
Expand Down Expand Up @@ -95,7 +95,7 @@ def pyecharts(request):
orient="vertical", pos_top="15%", pos_left="2%", is_show=False
))
pie4.set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"))
pie4.add("", [list(z) for z in zip(attr, value)])
pie4.add("", [list(z) for z in zip(attr, value)]) if attr and data else None

# SQL查询统计(DB检索行数)
data = chart_dao.querylog_effect_row_by_db(30)
Expand All @@ -107,7 +107,7 @@ def pyecharts(request):
orient="vertical", pos_top="15%", pos_left="2%", is_show=False
))
pie5.set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}", position="left"))
pie5.add("", [list(z) for z in zip(attr, value)])
pie5.add("", [list(z) for z in zip(attr, value)]) if attr and data else None

# 慢查询db/user维度统计(最近1天)
data = chart_dao.slow_query_count_by_db_by_user(1)
Expand All @@ -119,7 +119,7 @@ def pyecharts(request):
orient="vertical", pos_top="15%", pos_left="2%", is_show=False
))
pie3.set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}", position="left"))
pie3.add("", [list(z) for z in zip(attr, value)])
pie3.add("", [list(z) for z in zip(attr, value)]) if attr and data else None

# 慢查询db维度统计(最近1天)
data = chart_dao.slow_query_count_by_db(1)
Expand Down
19 changes: 8 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
Django==3.1.14
mysqlclient==2.0.1
Django==4.0.5
mysqlclient==2.0.3
requests==2.24.0
simplejson==3.17.2
mybatis_mapper2sql==0.1.9
django-auth-ldap==2.2.0
django-auth-ldap==4.1.0
python-dateutil==2.8.1
pymongo==3.11.0
psycopg2-binary==2.8.6
pymysql==0.9.3
mysql-replication==0.22
django-q==1.3.4
django-redis==4.12.1
django-q==1.3.9
django-redis==5.2.0
pyodbc==4.0.30
gunicorn==20.0.4
pyecharts==1.7.1
pyecharts==1.9.1
aliyun-python-sdk-rds==2.1.1
cx-Oracle==7.3.0
supervisor==4.1.0
phoenixdb==0.7
django-mirage-field==1.1.6
django-mirage-field==1.4.0
schema-sync==0.9.7
parsedatetime==2.4
sshtunnel==0.1.5
uvloop==0.14.0
httptools==0.1.1
uvicorn==0.12.2
pycryptodome==3.10.1
pandas==1.1.5
pyodps==0.10.7.1
clickhouse-driver==0.2.3
djangorestframework==3.13.1
djangorestframework-simplejwt==5.0.0
djangorestframework-simplejwt==5.2.0
django-filter==21.1
drf-spectacular==0.22.0
pyotp==2.6.0
Expand Down
4 changes: 2 additions & 2 deletions sql/data_dictionary.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: UTF-8 -*-
import datetime
import os
from urllib.parse import quote

import MySQLdb
import simplejson as json
from django.utils.http import urlquote
from django.template import loader
from archery import settings
from sql.engines import get_engine
Expand Down Expand Up @@ -107,7 +107,7 @@ def export(request):
if db_name:
response = FileResponse(open(f'{path}/{instance_name}_{db_name}.html', 'rb'))
response['Content-Type'] = 'application/octet-stream'
response['Content-Disposition'] = f'attachment;filename="{urlquote(instance_name)}_{urlquote(db_name)}.html"'
response['Content-Disposition'] = f'attachment;filename="{quote(instance_name)}_{quote(db_name)}.html"'
return response

else:
Expand Down
9 changes: 4 additions & 5 deletions sql_api/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.urls import path, include
from django.conf.urls import url
from sql_api import views
from rest_framework import routers
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView
Expand All @@ -17,17 +16,17 @@
path('swagger/', SpectacularSwaggerView.as_view(url_name='sql_api:schema'), name='swagger'),
path('redoc/', SpectacularRedocView.as_view(url_name='sql_api:schema'), name='redoc'),
path('v1/user/', api_user.UserList.as_view()),
url(r'^v1/user/(?P<pk>[0-9]+)/$', api_user.UserDetail.as_view()),
path('v1/user/<int:pk>/', api_user.UserDetail.as_view()),
path('v1/user/group/', api_user.GroupList.as_view()),
url(r'^v1/user/group/(?P<pk>[0-9]+)/$', api_user.GroupDetail.as_view()),
path('v1/user/group/<int:pk>/', api_user.GroupDetail.as_view()),
path('v1/user/resourcegroup/', api_user.ResourceGroupList.as_view()),
url(r'^v1/user/resourcegroup/(?P<pk>[0-9]+)/$', api_user.ResourceGroupDetail.as_view()),
path('v1/user/resourcegroup/<int:pk>/', api_user.ResourceGroupDetail.as_view()),
path('v1/user/auth/', api_user.UserAuth.as_view()),
path('v1/user/2fa/', api_user.TwoFA.as_view()),
path('v1/user/2fa/save/', api_user.TwoFASave.as_view()),
path('v1/user/2fa/verify/', api_user.TwoFAVerify.as_view()),
path('v1/instance/', api_instance.InstanceList.as_view()),
url(r'^v1/instance/(?P<pk>[0-9]+)/$', api_instance.InstanceDetail.as_view()),
path('v1/instance/<int:pk>/', api_instance.InstanceDetail.as_view()),
path('v1/instance/resource/', api_instance.InstanceResource.as_view()),
path('v1/instance/tunnel/', api_instance.TunnelList.as_view()),
path('v1/instance/rds/', api_instance.AliyunRdsList.as_view()),
Expand Down

0 comments on commit 878bdd9

Please sign in to comment.