initial commit

This commit is contained in:
hex
2025-05-19 20:13:39 -07:00
commit 11f14f5048
12 changed files with 1408 additions and 0 deletions

39
app/__init__.py Normal file
View File

@@ -0,0 +1,39 @@
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
# Initialize SQLAlchemy
db = SQLAlchemy()
def create_app():
app = Flask(__name__, instance_relative_config=True)
# Configure the app
app.config.from_mapping(
SECRET_KEY=os.environ.get('SECRET_KEY', 'dev'),
SQLALCHEMY_DATABASE_URI=f"sqlite:///{os.path.join(app.instance_path, 'game_tracker.sqlite')}",
SQLALCHEMY_TRACK_MODIFICATIONS=False,
)
# Ensure the instance folder exists
try:
os.makedirs(app.instance_path)
except OSError:
pass
# Initialize database with app
db.init_app(app)
# Import and register blueprints
from .routes import main_bp
app.register_blueprint(main_bp)
# Create database tables
with app.app_context():
db.create_all()
return app