diff --git a/yamdl_playground/core/apps.py b/yamdl_playground/core/apps.py index 86fea10..f3ee13c 100644 --- a/yamdl_playground/core/apps.py +++ b/yamdl_playground/core/apps.py @@ -1,6 +1,7 @@ from django.apps import AppConfig from django.db import connections from django.db.models.signals import post_save +import warnings class CoreConfig(AppConfig): name = "yamdl_playground.core" @@ -11,8 +12,11 @@ class CoreConfig(AppConfig): if not self.loaded: connection = connections["default"] - with connection.cursor() as cursor: - cursor.execute("CREATE VIRTUAL TABLE search_index USING fts5(body);") + with warnings.catch_warnings(): + # Django doesn't like running DB queries during app initialization + warnings.filterwarnings("ignore", module="django.db", category=RuntimeWarning) + with connection.cursor() as cursor: + cursor.execute("CREATE VIRTUAL TABLE search_index USING fts5(body);") post_save.connect(self.post_save) self.loaded = True