Files
quantumbotx/core/db/connection.py
T
Reynov Christian 351292c26a feat: add i18n support and prepare for Vercel deployment
- Streamlined .env.example to include only essential Flask and MT5 configs for production environments
- Added .vercel directory to .gitignore for clean Vercel deployments
- Enabled internationalization by adding data-i18n attributes to strategy switcher UI elements
- Updated MT5 setup guide and roadmap documentation for clarity and current focus

This change simplifies configuration for server deployment while enhancing UI accessibility across languages.
2025-10-16 01:47:55 +08:00

25 lines
796 B
Python

# core/db/connection.py
import sqlite3
import os
import sys
# Tentukan nama file database di satu tempat.
DATABASE_FILENAME = 'bots.db'
def get_db_connection():
"""Membuat dan mengembalikan koneksi ke database SQLite."""
# Get the directory where the executable is located
if getattr(sys, 'frozen', False):
# Running as PyInstaller bundle
base_dir = os.path.dirname(sys.executable)
db_path = os.path.join(base_dir, DATABASE_FILENAME)
else:
# Running as script
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
db_path = os.path.join(BASE_DIR, '..', '..', DATABASE_FILENAME)
conn = sqlite3.connect(db_path)
# Mengatur agar hasil query bisa diakses seperti dictionary
conn.row_factory = sqlite3.Row
return conn