Personal-Digital-Asset-Manager/config.py
Timothy Rogers b0a4567169 add code
2024-11-10 16:01:57 -05:00

15 lines
636 B
Python

import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY', 'your-secret-key')
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL', 'sqlite:///' + os.path.join(BASE_DIR, 'instance', 'app.db'))
SQLALCHEMY_TRACK_MODIFICATIONS = False
UPLOAD_FOLDER = os.path.join(BASE_DIR, 'static', 'uploads')
@staticmethod
def init_app(app):
# Create necessary directories
os.makedirs(os.path.dirname(app.config['SQLALCHEMY_DATABASE_URI'].replace('sqlite:///', '')), exist_ok=True)
os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True)