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.apps import AppConfig
|
||||||
from django.db import connections
|
from django.db import connections
|
||||||
from django.db.models.signals import post_save
|
from django.db.models.signals import post_save
|
||||||
|
import warnings
|
||||||
|
|
||||||
class CoreConfig(AppConfig):
|
class CoreConfig(AppConfig):
|
||||||
name = "yamdl_playground.core"
|
name = "yamdl_playground.core"
|
||||||
|
@ -11,8 +12,11 @@ class CoreConfig(AppConfig):
|
||||||
if not self.loaded:
|
if not self.loaded:
|
||||||
connection = connections["default"]
|
connection = connections["default"]
|
||||||
|
|
||||||
with connection.cursor() as cursor:
|
with warnings.catch_warnings():
|
||||||
cursor.execute("CREATE VIRTUAL TABLE search_index USING fts5(body);")
|
# 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)
|
post_save.connect(self.post_save)
|
||||||
self.loaded = True
|
self.loaded = True
|
||||||
|
|
Loading…
Reference in a new issue