2020-05-01 22:46:15 +08:00
|
|
|
from django.apps import AppConfig
|
2023-11-24 20:41:28 -05:00
|
|
|
from django.core.checks import Tags, register
|
2023-09-02 20:53:32 +00:00
|
|
|
from django.db.models.signals import post_migrate
|
2020-05-01 22:46:15 +08:00
|
|
|
|
|
|
|
|
|
|
|
class CommonConfig(AppConfig):
|
2023-01-11 19:11:31 -05:00
|
|
|
name = "common"
|
2023-09-02 20:53:32 +00:00
|
|
|
|
|
|
|
def ready(self):
|
|
|
|
post_migrate.connect(self.setup, sender=self)
|
|
|
|
|
|
|
|
def setup(self, **kwargs):
|
|
|
|
from .setup import Setup
|
|
|
|
|
2024-06-17 15:10:34 -04:00
|
|
|
if kwargs.get("using", "") == "default":
|
|
|
|
# only run setup on the default database, not on takahe
|
|
|
|
Setup().run()
|
2023-11-24 20:41:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
@register(Tags.admin, deploy=True)
|
|
|
|
def setup_check(app_configs, **kwargs):
|
|
|
|
from .setup import Setup
|
|
|
|
|
|
|
|
return Setup().check()
|