Updated application files and gitignore
This commit is contained in:
parent
68b99755ec
commit
506e4d45d4
8
.env
8
.env
@ -4,10 +4,10 @@ SECRET_KEY=6c9d28c778888d3fc7c459155e6593f8
|
||||
EMAIL_HOST=mail.sq0715.com
|
||||
EMAIL_PORT=465
|
||||
MAIL_USE_SSL=True
|
||||
EMAIL_USERNAME=vip@sq0715.com
|
||||
EMAIL_PASSWORD=Lsq12350501.
|
||||
EMAIL_FROM_NAME=Qin
|
||||
EMAIL_FROM=vip@sq0715.com
|
||||
EMAIL_USERNAME=3399560459@qq.com
|
||||
EMAIL_PASSWORD=ubbgchcvkhnwcijj
|
||||
EMAIL_FROM_NAME=SumKim_OFFICIAL
|
||||
EMAIL_FROM=3399560459@qq.com
|
||||
|
||||
# AWS 配置
|
||||
AWS_ACCESS_KEY_ID=AKIAZQ3DT3KLI6N5LQUM
|
||||
|
8
.gitignore
vendored
8
.gitignore
vendored
@ -1 +1,7 @@
|
||||
myenv/
|
||||
venv/
|
||||
flask_session/
|
||||
.idea/
|
||||
__pycache__/
|
||||
nohup.out
|
||||
output_files_content.docx
|
||||
output.log
|
12
app.py
12
app.py
@ -13,7 +13,7 @@ load_dotenv()
|
||||
|
||||
# 初始化 Flask 应用
|
||||
app = Flask(__name__, static_url_path='', static_folder='.')
|
||||
CORS(app, resources={r"/*": {"origins": "*"}})
|
||||
CORS(app, resources={r"/*": {"origins": "*", "methods": "GET,POST,PUT,DELETE,OPTIONS"}})
|
||||
bcrypt = Bcrypt(app)
|
||||
|
||||
# 确保 SECRET_KEY 被设置
|
||||
@ -26,12 +26,12 @@ Session(app)
|
||||
|
||||
# 配置邮件
|
||||
app.config.update(
|
||||
MAIL_SERVER=os.getenv('EMAIL_HOST'),
|
||||
MAIL_PORT=os.getenv('EMAIL_PORT'),
|
||||
MAIL_SERVER='smtp.qq.com', # QQ smtp服务器
|
||||
MAIL_PORT=465, # 端口
|
||||
MAIL_USE_SSL=True,
|
||||
MAIL_USERNAME=os.getenv('EMAIL_USERNAME'),
|
||||
MAIL_PASSWORD=os.getenv('EMAIL_PASSWORD'),
|
||||
MAIL_DEFAULT_SENDER=(os.getenv('EMAIL_FROM_NAME'), os.getenv('EMAIL_FROM'))
|
||||
MAIL_USERNAME='3399560459@qq.com', # 发件邮箱
|
||||
MAIL_PASSWORD='ubbgchcvkhnwcijj', # 授权码
|
||||
MAIL_DEFAULT_SENDER=('SumKim_OFFICIAL', '3399560459@qq.com')
|
||||
)
|
||||
mail = Mail(app)
|
||||
|
||||
|
@ -508,7 +508,10 @@ def add_admin_routes(app, mail, bcrypt):
|
||||
_, file_extension = os.path.splitext(filename) # 通过前端传递的文件提取扩展名
|
||||
|
||||
# 生成新的文件名,并确保文件扩展名保持正确
|
||||
new_filename = f'{student_id}_{student_name}_{assignment}{file_extension}'
|
||||
# 提取学号的最后两位
|
||||
student_last_two_digits = student_id[-2:]
|
||||
# 使用学号最后两位、学生名、作业名生成文件名
|
||||
new_filename = f'{student_last_two_digits}_{student_name}_{assignment}{file_extension}'
|
||||
folder_name = f'sure_homework_define_by_qin/{assignment}'
|
||||
object_key = f'{folder_name}/{new_filename}'
|
||||
|
||||
@ -576,7 +579,10 @@ def add_admin_routes(app, mail, bcrypt):
|
||||
_, file_extension = os.path.splitext(filename) # 获取文件的后缀名
|
||||
|
||||
# 使用学号、学生名、作业名生成文件名(不含后缀)
|
||||
new_filename = f'{student_id}_{session.get("student_name")}_{assignment}{file_extension}'
|
||||
# 提取学号的最后两位
|
||||
student_last_two_digits = student_id[-2:]
|
||||
# 使用学号最后两位、学生名、作业名生成文件名
|
||||
new_filename = f'{student_last_two_digits}_{session.get("student_name")}_{assignment}{file_extension}'
|
||||
folder_name = f'sure_homework_define_by_qin/{assignment}'
|
||||
|
||||
# 生成对象键前缀(不含扩展名),用于查找已存在的文件
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7368
output.log
7368
output.log
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user