Compare commits
No commits in common. "f9a9774af727383f62327c75527b7a4baa3c902e" and "c8a6ced7a09d1d1394099fea844515c22e032705" have entirely different histories.
f9a9774af7
...
c8a6ced7a0
|
|
@ -1,3 +1,4 @@
|
||||||
|
from aip import AipSpeech
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
import uuid
|
import uuid
|
||||||
import os
|
import os
|
||||||
|
|
@ -16,7 +17,6 @@ def generate_voice(msg: str, per: int = 0):
|
||||||
str: 地址
|
str: 地址
|
||||||
dict: result
|
dict: result
|
||||||
"""
|
"""
|
||||||
from aip import AipSpeech
|
|
||||||
client = AipSpeech(settings.BD_SP_ID, settings.BD_SP_KEY, settings.BD_SP_SECRET)
|
client = AipSpeech(settings.BD_SP_ID, settings.BD_SP_KEY, settings.BD_SP_SECRET)
|
||||||
result = client.synthesis(msg, 'zh', 1, {'vol': 5, 'spd': 5, 'per': per})
|
result = client.synthesis(msg, 'zh', 1, {'vol': 5, 'spd': 5, 'per': per})
|
||||||
# 识别正确返回语音二进制 错误则返回dict 参照下面错误码
|
# 识别正确返回语音二进制 错误则返回dict 参照下面错误码
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,21 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import cv2
|
||||||
|
from django.http import HttpResponse
|
||||||
from apps.utils.errors import SIGN_MAKE_FAIL
|
from apps.utils.errors import SIGN_MAKE_FAIL
|
||||||
from server.settings import BASE_DIR
|
from server.settings import BASE_DIR
|
||||||
|
import numpy as np
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.exceptions import ParseError
|
from rest_framework.exceptions import ParseError
|
||||||
from apps.utils.viewsets import CustomGenericViewSet
|
from apps.utils.viewsets import CustomGenericViewSet
|
||||||
from apps.utils.mixins import CustomCreateModelMixin
|
from apps.utils.mixins import CustomCreateModelMixin
|
||||||
from apps.utils.serializers import GenSignatureSerializer
|
from apps.utils.serializers import GenSignatureSerializer
|
||||||
|
from rest_framework.views import APIView
|
||||||
|
from rest_framework.decorators import action
|
||||||
|
from rest_framework.serializers import Serializer
|
||||||
|
from django.core.cache import cache
|
||||||
|
import json
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
class SignatureViewSet(CustomCreateModelMixin, CustomGenericViewSet):
|
class SignatureViewSet(CustomCreateModelMixin, CustomGenericViewSet):
|
||||||
|
|
@ -20,8 +29,6 @@ class SignatureViewSet(CustomCreateModelMixin, CustomGenericViewSet):
|
||||||
|
|
||||||
照片生成透明签名图片
|
照片生成透明签名图片
|
||||||
"""
|
"""
|
||||||
import cv2
|
|
||||||
import numpy as np
|
|
||||||
path = (BASE_DIR + request.data['path']).replace('\\', '/')
|
path = (BASE_DIR + request.data['path']).replace('\\', '/')
|
||||||
try:
|
try:
|
||||||
image = cv2.imread(path, cv2.IMREAD_UNCHANGED)
|
image = cv2.imread(path, cv2.IMREAD_UNCHANGED)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('wf', '0003_workflow_view_path'),
|
('wf', '0004_workflow_view_path2'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
SECRET_KEY = 'xx'
|
||||||
|
DEBUG = False
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
|
'NAME': 'xx',
|
||||||
|
'USER': 'postgres',
|
||||||
|
'PASSWORD': 'xx',
|
||||||
|
'HOST': 'xx',
|
||||||
|
'PORT': '5432',
|
||||||
|
}
|
||||||
|
}
|
||||||
10
readme.md
10
readme.md
|
|
@ -1,17 +1,9 @@
|
||||||
## 如何运行
|
## 如何运行
|
||||||
|
|
||||||
将 server 下的 conf_e.json 以及 conf_e.py,移动到config文件夹下并重命名为 conf.json 和 conf.py。
|
将 server 下的 conf_e.json 以及 conf_e.py,重名名为 conf.json 和 conf.py。
|
||||||
|
|
||||||
根据自己的情况修改参数
|
根据自己的情况修改参数
|
||||||
|
|
||||||
进入虚拟环境后运行 python manage.py migrate
|
|
||||||
|
|
||||||
导入初始数据 python manage.py loaddata db.json
|
|
||||||
|
|
||||||
默认管理员账户密码为admin xtadmin123!
|
|
||||||
|
|
||||||
在项目目录下执行 python manage.py runserver 即可
|
在项目目录下执行 python manage.py runserver 即可
|
||||||
|
|
||||||
运行后在 localhost:8000/api/swagger/下查看 api 文档
|
运行后在 localhost:8000/api/swagger/下查看 api 文档
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,7 @@
|
||||||
"base_name": "xx平台",
|
"base_name": "xx平台",
|
||||||
"base_logo": "/media/default/logo.png",
|
"base_logo": "/media/default/logo.png",
|
||||||
"base_name_short": "xx",
|
"base_name_short": "xx",
|
||||||
"base_logo_side": "",
|
"base_logo_side": ""
|
||||||
"base_menucate": "dynamic"
|
|
||||||
},
|
},
|
||||||
"apk": {
|
"apk": {
|
||||||
"apk_version": "1.0",
|
"apk_version": "1.0",
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,7 @@ EMAIL_USE_TLS = True
|
||||||
|
|
||||||
|
|
||||||
# 数据库配置
|
# 数据库配置
|
||||||
CACHES = {
|
CACHE_LOCATION = "redis://127.0.0.1:6379/2"
|
||||||
'default': {
|
|
||||||
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
|
|
||||||
'LOCATION': 'redis://127.0.0.1:6379/2', # Redis URL
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CELERY_BROKER_URL = "redis://127.0.0.1:6379/3"
|
CELERY_BROKER_URL = "redis://127.0.0.1:6379/3"
|
||||||
CELERY_TASK_DEFAULT_QUEUE = BASE_PROJECT_CODE
|
CELERY_TASK_DEFAULT_QUEUE = BASE_PROJECT_CODE
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
|
@ -37,6 +32,11 @@ DATABASES = {
|
||||||
# 雪花ID
|
# 雪花ID
|
||||||
SNOW_DATACENTER_ID = 1
|
SNOW_DATACENTER_ID = 1
|
||||||
|
|
||||||
|
# 百度语音
|
||||||
|
BD_SP_ID = 'xx'
|
||||||
|
BD_SP_KEY = 'xx'
|
||||||
|
BD_SP_SECRET = 'xx'
|
||||||
|
|
||||||
# 运维相关
|
# 运维相关
|
||||||
SD_PWD = 'xx'
|
SD_PWD = 'xx'
|
||||||
BACKUP_PATH = '/home/xx/xx/xx'
|
BACKUP_PATH = '/home/xx/xx/xx'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue