dwm-app/utils/data_sources.py

17 lines
347 B
Python
Raw Normal View History

2024-02-28 20:52:15 +00:00
from flask import g
import os, sqlite3
DATABASE = "static/data/database.db"
def connect_db():
return sqlite3.connect(DATABASE)
def before_request():
g.db = connect_db()
def teardown_request(exception):
if hasattr(g, "db"):
g.db.close()
breeding_pair_data = os.path.join('static', 'data', 'breeding_pair_data.csv')