Compare commits
2 Commits
285c273b01
...
d1db42fd58
| Author | SHA1 | Date | |
|---|---|---|---|
| d1db42fd58 | |||
| db0cd90237 |
38
backend.py
38
backend.py
@ -1,11 +1,12 @@
|
||||
import os
|
||||
import traceback
|
||||
from matplotlib import pyplot as plt
|
||||
from modules import cosmic
|
||||
from modules import tidi
|
||||
from modules import saber
|
||||
from modules import radar
|
||||
from modules import balloon
|
||||
from quart import Quart, request
|
||||
from quart import Quart, jsonify, request
|
||||
from quart_cors import cors
|
||||
from typing import get_args
|
||||
import sys
|
||||
@ -42,6 +43,41 @@ def auth():
|
||||
if _code != code:
|
||||
return "Unauthorized", 401
|
||||
|
||||
# Global error handler for all exceptions
|
||||
|
||||
|
||||
@app.errorhandler(Exception)
|
||||
async def handle_exception(e):
|
||||
"""Global error handler that catches all exceptions"""
|
||||
# Get the error details
|
||||
error_class = e.__class__.__name__
|
||||
error_message = str(e)
|
||||
|
||||
# Get stack trace
|
||||
stack_trace = traceback.format_exc()
|
||||
|
||||
# Log the error (you might want to use a proper logger)
|
||||
print(f"Exception occurred: {error_class} - {error_message}")
|
||||
print(f"Stack Trace: {stack_trace}")
|
||||
|
||||
# Determine appropriate status code
|
||||
status_code = 500 # Default to internal server error
|
||||
|
||||
# Return a consistent error response
|
||||
response = {
|
||||
"success": False,
|
||||
"error": {
|
||||
"type": 500,
|
||||
"message": error_message
|
||||
}
|
||||
}
|
||||
|
||||
# Only include stack trace in debug mode (not in production)
|
||||
if app.debug:
|
||||
response["error"]["stack_trace"] = stack_trace.split('\n')
|
||||
|
||||
return jsonify(response), status_code
|
||||
|
||||
|
||||
@app.route('/')
|
||||
async def return_index_html():
|
||||
|
||||
2
build.sh
2
build.sh
@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd ../frontend && pnpm build && cd ../backend
|
||||
|
||||
pyinstaller --add-data "./res/*:res" --add-data "./res/assets/*:res/assets" ./backend.py
|
||||
|
||||
@ -103,6 +103,9 @@ def saber_planetw_plot(
|
||||
|
||||
# 对每一列生成独立的子图
|
||||
col = k_to_a[f'k={k}']
|
||||
# 清理上一次的图形
|
||||
plt.clf()
|
||||
|
||||
plt.plot(x_values, fit_df[col].values)
|
||||
plt.suptitle(f'k = {k} 振幅图')
|
||||
plt.xlabel('天')
|
||||
|
||||
@ -80,7 +80,7 @@ class NcData:
|
||||
return iter([self.dataset, self.tplatitude, self.tplongitude, self.tpaltitude, self.ktemp, self.time, self.date, self.date_time])
|
||||
|
||||
|
||||
ENABLE_SABER_FILTERING = True # 是否启用SABER数据的过滤
|
||||
ENABLE_SABER_FILTERING = False # 是否启用SABER数据的过滤
|
||||
|
||||
|
||||
def data_nc_load(file_path):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user