Add initial files for Audio Dashboard Management System
- Created .env.example for environment variable configuration. - Added docker-compose.yml for service orchestration. - Implemented frequency response extraction in extract_frequency_response.py and convert_to_frequency_db.py. - Generated output files: frequency_response_detailed.json, frequency_response_points.json, frequency_response.csv, and frequency_response_curve.png. - Included sample measurement data for FiiO FA19 in CSV format.
This commit is contained in:
+16
-2
@@ -1,6 +1,7 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
import os
|
||||
import logging
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from database import engine, Base
|
||||
@@ -9,12 +10,25 @@ from routes import brands_router, models_router
|
||||
# Load environment variables
|
||||
load_dotenv()
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||
handlers=[
|
||||
logging.StreamHandler(), # 输出到控制台
|
||||
logging.FileHandler('logs/app.log', encoding='utf-8') # 输出到文件
|
||||
]
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Create database tables (only if tables don't exist)
|
||||
try:
|
||||
logger.info("Creating database tables...")
|
||||
Base.metadata.create_all(bind=engine)
|
||||
logger.info("Database tables created successfully")
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not create tables: {e}")
|
||||
print("Continuing without table creation...")
|
||||
logger.error(f"Warning: Could not create tables: {e}")
|
||||
logger.error("Continuing without table creation...")
|
||||
|
||||
# Create FastAPI app
|
||||
app = FastAPI(
|
||||
|
||||
Reference in New Issue
Block a user