Hide warnings
This commit is contained in:
parent
aab93a4d3e
commit
d5988001a3
1 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue