Commit 9b3ccdea authored by pengxiong's avatar pengxiong

修改图片pdf路径配置

parent b56af54b
...@@ -19,11 +19,11 @@ from sqlalchemy.orm import sessionmaker, scoped_session ...@@ -19,11 +19,11 @@ from sqlalchemy.orm import sessionmaker, scoped_session
env = sys.argv[-1] env = sys.argv[-1]
work_dir = os.getcwd() work_dir = os.getcwd()
CFG_FILEPATH = work_dir + '/app/config/config.yaml' CFG_FILEPATH = work_dir + '/app/config/config.yaml'
template_folder = work_dir+'/app/templates'
pdf_folder = work_dir+'/app/pdf/'
config = yaml.load(open(CFG_FILEPATH, 'r'), Loader=yaml.FullLoader) config = yaml.load(open(CFG_FILEPATH, 'r'), Loader=yaml.FullLoader)
template_folder = config[env]['oss']['imgs_url_prefix']
pdf_folder = config[env]['oss']['pdf_url_prefix']
tamp_product_engine = create_engine( tamp_product_engine = create_engine(
'mysql+mysqldb://{user}:{password}@{host}:{port}/{db}?charset={charset}'.format( 'mysql+mysqldb://{user}:{password}@{host}:{port}/{db}?charset={charset}'.format(
......
...@@ -38,6 +38,9 @@ test: ...@@ -38,6 +38,9 @@ test:
host: localhost host: localhost
port: 6379 port: 6379
db: 0 db: 0
oss:
imgs_url_prefix: https://testtamper.tanpuyun.com/hangjiapc/report/productionenv/ReportTempImg/
pdf_url_prefix: https://testtamper.tanpuyun.com/hangjiapc/report/productionenv/AppHoldReport/
log: log:
filename: /logs/fund_report.log filename: /logs/fund_report.log
filemode: a filemode: a
...@@ -61,6 +64,8 @@ prod: ...@@ -61,6 +64,8 @@ prod:
port: 6379 port: 6379
db: 0 db: 0
oss: oss:
imgs_url_prefix: https://tamper.tanpuyun.com/hangjiapc/report/productionenv/ReportTempImg/
pdf_url_prefix: https://tamper.tanpuyun.com/hangjiapc/report/productionenv/AppHoldReport/
account: LTAI4FzkGhAMecinBCKwuoUW account: LTAI4FzkGhAMecinBCKwuoUW
password: KJpPWg9U0kYO71yB41gqYbrFNJ4hso password: KJpPWg9U0kYO71yB41gqYbrFNJ4hso
log: log:
......
...@@ -47,19 +47,16 @@ hold_default_template = { ...@@ -47,19 +47,16 @@ hold_default_template = {
'box8': 'block', 'box8': 'block',
'cover_title1': '资产', 'cover_title1': '资产',
'cover_title2': '存续报告', 'cover_title2': '存续报告',
'logo': '', 'logo': template_folder + 'logo.png',
# 'logo': img_transfer(template_folder + '/v2/img/logo.png'),
'brand_name': '小飞象', 'brand_name': '小飞象',
'logo_display': 'block', 'logo_display': 'block',
'brand_name_display': 'block', 'brand_name_display': 'block',
'financial_text': '我们挣的是⻆度和变化的钱而不是纠正市场错误的钱,市场永远是正确的,关键是在其正确被反复证明后的逆向而行,一定是避开它的正确被展开的过程。', 'financial_text': '我们挣的是⻆度和变化的钱而不是纠正市场错误的钱,市场永远是正确的,关键是在其正确被反复证明后的逆向而行,一定是避开它的正确被展开的过程。',
# 'cover_back': img_transfer(template_folder + '/v2/img/cover-back.png'), 'cover_back': template_folder + 'cover-back.png',
# 'scene': img_transfer(template_folder + '/v2/img/scene.png'), 'scene': template_folder + 'scene.png',
'cover_back': '', 'team': template_folder + 'default-user.png',
'scene': '', 'red_rect': template_folder + 'red-rect.png',
# 'team': img_transfer(template_folder + '/v2/img/default-user.png'), 'sh': template_folder + 'sh.png',
# 'red_rect': img_transfer(template_folder + '/v2/img/red-rect.png'),
# 'sh': img_transfer(template_folder + '/v2/img/sh.png'),
} }
diagnose_default_template = { diagnose_default_template = {
...@@ -101,16 +98,16 @@ diagnose_default_template = { ...@@ -101,16 +98,16 @@ diagnose_default_template = {
'logo': '', 'logo': '',
'cover_back': '', 'cover_back': '',
'scene': '', 'scene': '',
# 'logo': img_transfer(template_folder + '/v2/img/logo.png'), 'logo': template_folder + 'logo.png',
'brand_name': '小飞象', 'brand_name': '小飞象',
'logo_display': 'block', 'logo_display': 'block',
'brand_name_display': 'block', 'brand_name_display': 'block',
'financial_text': '我们挣的是⻆度和变化的钱而不是纠正市场错误的钱,市场永远是正确的,关键是在其正确被反复证明后的逆向而行,一定是避开它的正确被展开的过程。', 'financial_text': '我们挣的是⻆度和变化的钱而不是纠正市场错误的钱,市场永远是正确的,关键是在其正确被反复证明后的逆向而行,一定是避开它的正确被展开的过程。',
# 'cover_back': img_transfer(template_folder + '/v2/img/cover-back.png'), 'cover_back': template_folder + 'cover-back.png',
# 'scene': img_transfer(template_folder + '/v2/img/scene.png'), 'scene': template_folder + 'scene.png',
# 'team': img_transfer(template_folder + '/v2/img/default-user.png'), 'team': template_folder + 'default-user.png',
# 'red_rect': img_transfer(template_folder + '/v2/img/red-rect.png'), 'red_rect': template_folder + 'red-rect.png',
# 'sh': img_transfer(template_folder + '/v2/img/sh.png'), 'sh': template_folder + 'sh.png',
} }
hold_default_data = { hold_default_data = {
# -*- encoding: utf-8 -*-
# -----------------------------------------------------------------------------
# @File Name : __init__.py.py
# @Time : 2021/1/15 上午10:20
# @Author : X. Peng
# @Email : acepengxiong@163.com
# @Software : PyCharm
# -----------------------------------------------------------------------------
This diff is collapsed.
...@@ -98,9 +98,9 @@ def draw_month_return_chart(xlabels, product_list, cumulative): ...@@ -98,9 +98,9 @@ def draw_month_return_chart(xlabels, product_list, cumulative):
# imgdata.seek(0) # rewind the data # imgdata.seek(0) # rewind the data
# month_return_img = 'data:image/png;base64,' + base64.b64encode(imgdata.getvalue()).decode('utf-8') # month_return_img = 'data:image/png;base64,' + base64.b64encode(imgdata.getvalue()).decode('utf-8')
filename = str(uuid.uuid4()) + '.png' filename = str(uuid.uuid4()) + '.png'
filepath = template_folder + '/temp_img/' + filename filepath = template_folder + filename
fig.savefig(filepath, format='png', bbox_inches='tight') fig.savefig(filepath, format='png', bbox_inches='tight')
return filename return filepath
def draw_contribution_chart(xlabels, product_list, cumulative): def draw_contribution_chart(xlabels, product_list, cumulative):
...@@ -165,9 +165,9 @@ def draw_contribution_chart(xlabels, product_list, cumulative): ...@@ -165,9 +165,9 @@ def draw_contribution_chart(xlabels, product_list, cumulative):
# month_return_img = 'data:image/png;base64,' + base64.b64encode(imgdata.getvalue()).decode('utf-8') # month_return_img = 'data:image/png;base64,' + base64.b64encode(imgdata.getvalue()).decode('utf-8')
# return month_return_img # return month_return_img
filename = str(uuid.uuid4()) + '.png' filename = str(uuid.uuid4()) + '.png'
filepath = template_folder + '/temp_img/' + filename filepath = template_folder + filename
fig.savefig(filepath, format='png', bbox_inches='tight') fig.savefig(filepath, format='png', bbox_inches='tight')
return filename return filepath
# def draw_contribution_chart(xlabels, product_list, cumulative): # def draw_contribution_chart(xlabels, product_list, cumulative):
# """贡献分解图""" # """贡献分解图"""
...@@ -309,9 +309,9 @@ def draw_old_combination_chart(xlabels, origin_combination, index): ...@@ -309,9 +309,9 @@ def draw_old_combination_chart(xlabels, origin_combination, index):
# return_compare_img = 'data:image/png;base64,' + base64.b64encode(imgdata.getvalue()).decode('utf-8') # return_compare_img = 'data:image/png;base64,' + base64.b64encode(imgdata.getvalue()).decode('utf-8')
# return return_compare_img # return return_compare_img
filename = str(uuid.uuid4()) + '.png' filename = str(uuid.uuid4()) + '.png'
filepath = template_folder + '/temp_img/' + filename filepath = template_folder + filename
fig.savefig(filepath, format='png', bbox_inches='tight') fig.savefig(filepath, format='png', bbox_inches='tight')
return filename return filepath
def draw_combination_chart(xlabels, new_combination, origin_combination, index): def draw_combination_chart(xlabels, new_combination, origin_combination, index):
...@@ -359,9 +359,9 @@ def draw_combination_chart(xlabels, new_combination, origin_combination, index): ...@@ -359,9 +359,9 @@ def draw_combination_chart(xlabels, new_combination, origin_combination, index):
# return_compare_img = 'data:image/png;base64,' + base64.b64encode(imgdata.getvalue()).decode('utf-8') # return_compare_img = 'data:image/png;base64,' + base64.b64encode(imgdata.getvalue()).decode('utf-8')
# return return_compare_img # return return_compare_img
filename = str(uuid.uuid4()) + '.png' filename = str(uuid.uuid4()) + '.png'
filepath = template_folder + '/temp_img/' + filename filepath = template_folder + filename
fig.savefig(filepath, format='png', bbox_inches='tight') fig.savefig(filepath, format='png', bbox_inches='tight')
return filename return filepath
def draw_index_combination_chart(compare_data): def draw_index_combination_chart(compare_data):
...@@ -415,9 +415,9 @@ def draw_index_combination_chart(compare_data): ...@@ -415,9 +415,9 @@ def draw_index_combination_chart(compare_data):
# return_compare_img = 'data:image/png;base64,' + base64.b64encode(imgdata.getvalue()).decode('utf-8') # return_compare_img = 'data:image/png;base64,' + base64.b64encode(imgdata.getvalue()).decode('utf-8')
# return return_compare_img # return return_compare_img
filename = str(uuid.uuid4()) + '.png' filename = str(uuid.uuid4()) + '.png'
filepath = template_folder + '/temp_img/' + filename filepath = template_folder + filename
fig.savefig(filepath, format='png', bbox_inches='tight') fig.savefig(filepath, format='png', bbox_inches='tight')
return filename return filepath
if __name__ == '__main__': if __name__ == '__main__':
# xlabels = ('2020-1', '2020-2', '2020-3', '2020-4', '2020-5', '2020-6', '2020-7', '2020-8', '2020-9', '2020-10', '2020-11', '2020-12') # xlabels = ('2020-1', '2020-2', '2020-3', '2020-4', '2020-5', '2020-6', '2020-7', '2020-8', '2020-9', '2020-10', '2020-11', '2020-12')
......
...@@ -97,9 +97,9 @@ def gen_radar_chart(radar_chart_data): ...@@ -97,9 +97,9 @@ def gen_radar_chart(radar_chart_data):
# return img_content # return img_content
filename = str(uuid.uuid4()) + '.png' filename = str(uuid.uuid4()) + '.png'
filepath = template_folder + '/temp_img/' + filename filepath = template_folder + filename
cv2.imwrite(filepath, img) cv2.imwrite(filepath, img)
return filename return filepath
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment