1
0
Files
medical-notes/stroma/quiz/apps.py
Johan Dahlin 50366b9b9c
All checks were successful
Deploy Quartz site to GitHub Pages / build (push) Successful in 2m29s
vault backup: 2025-12-26 02:09:22
2025-12-26 02:09:22 +01:00

24 lines
876 B
Python

import os
import sys
from django.apps import AppConfig
class QuizAppConfig(AppConfig):
name = 'quiz'
default_auto_field = 'django.db.models.BigAutoField'
def ready(self):
"""
App initialization code.
Starts the auto-import watcher in a background thread.
"""
# Only run in the main process (not in reloader process)
# And not during management commands or pytest tests
is_management_command = any(cmd in sys.argv for cmd in ['import_questions', 'migrate', 'makemigrations', 'shell'])
is_pytest = 'pytest' in sys.argv[0] or 'PYTEST_CURRENT_TEST' in os.environ
if not is_management_command and not is_pytest and (os.environ.get('RUN_MAIN') == 'true' or os.environ.get('RUN_MAIN') is None):
from quiz.utils.watcher import start_watcher_thread
start_watcher_thread()