fix: 修改数据库连接信息
This commit is contained in:
parent
cf95f2db0b
commit
346644d207
|
@ -368,21 +368,18 @@ class ParsePdfViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet):
|
||||||
"""
|
"""
|
||||||
解析pdf到excel
|
解析pdf到excel
|
||||||
"""
|
"""
|
||||||
try:
|
|
||||||
pdf_file = request.data['pdf_file']
|
pdf_file = request.data['pdf_file']
|
||||||
annual = request.data['annual']
|
annual = request.data['annual']
|
||||||
# 读数据路径copy 在media 下新建excel,解析完成后存入数据库。
|
# 读数据路径copy 在media 下新建excel,解析完成后存入数据库。
|
||||||
media_excel = os.path.join(os.path.dirname(EXCEL_PATH),"media_excel")
|
media_excel = os.path.join(os.path.dirname(EXCEL_PATH),"media_excel")
|
||||||
if not os.path.exists(media_excel):
|
if not os.path.exists(media_excel):
|
||||||
os.makedirs(media_excel)
|
os.makedirs(media_excel)
|
||||||
shutil.copy(EXCEL_PATH, media_excel)
|
shutil.copy(EXCEL_PATH, media_excel)
|
||||||
save_path = os.path.join(media_excel, os.path.basename(EXCEL_PATH))
|
save_path = os.path.join(media_excel, os.path.basename(EXCEL_PATH))
|
||||||
server_pdf_path = settings.BASE_DIR + pdf_file
|
server_pdf_path = settings.BASE_DIR + pdf_file
|
||||||
download_excel_path = save_path.split("server")[-1]
|
download_excel_path = save_path.split("server")[-1]
|
||||||
run(server_pdf_path, save_path)
|
run(server_pdf_path, save_path)
|
||||||
except Exception:
|
|
||||||
traceback.print_exc()
|
|
||||||
return Response({"message":"解析失败"}, status = status.HTTP_400_BAD_REQUEST)
|
|
||||||
Parsepdf.objects.create(
|
Parsepdf.objects.create(
|
||||||
pdf_path=pdf_file,
|
pdf_path=pdf_file,
|
||||||
excel_path= EXCEL_PATH,
|
excel_path= EXCEL_PATH,
|
||||||
|
|
|
@ -18,13 +18,24 @@ DATABASES = {
|
||||||
# # 'HOST': '1.203.161.102',
|
# # 'HOST': '1.203.161.102',
|
||||||
# 'PORT': '5432',
|
# 'PORT': '5432',
|
||||||
# }
|
# }
|
||||||
'default': {
|
# 'default': {
|
||||||
|
# 'ENGINE': 'django.db.backends.postgresql',
|
||||||
|
# 'NAME': 'cma',
|
||||||
|
# 'USER': 'postgres',
|
||||||
|
# 'PASSWORD': 'zcDsj2021',
|
||||||
|
# 'HOST': '49.232.14.174',
|
||||||
|
# # 'HOST': '1.203.161.102',
|
||||||
|
# 'PORT': '5432',
|
||||||
|
# },
|
||||||
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.postgresql',
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
'NAME': 'cma',
|
'NAME': 'cma',
|
||||||
'USER': 'postgres',
|
'USER': 'cma',
|
||||||
'PASSWORD': 'zcDsj2021',
|
'PASSWORD': 'cma123',
|
||||||
'HOST': '49.232.14.174',
|
# 'HOST': '127.0.0.1',
|
||||||
# 'HOST': '1.203.161.102',
|
'HOST': '1.203.161.102',
|
||||||
'PORT': '5432',
|
'PORT': '5432',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue