2022-11-05 20:17:27 +00:00
|
|
|
from django.apps import AppConfig
|
2022-11-23 00:06:32 +00:00
|
|
|
from django.db.models.signals import post_migrate
|
2022-11-05 20:17:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
class UsersConfig(AppConfig):
|
|
|
|
default_auto_field = "django.db.models.BigAutoField"
|
|
|
|
name = "users"
|
2022-11-21 01:29:19 +00:00
|
|
|
|
2022-11-23 00:06:32 +00:00
|
|
|
def data_init(self, **kwargs):
|
|
|
|
"""
|
|
|
|
Runs after migrations or flushes to insert anything we need for first
|
|
|
|
boot (or post upgrade).
|
|
|
|
"""
|
|
|
|
# Generate the server actor keypair if needed
|
|
|
|
from users.models import SystemActor
|
|
|
|
|
|
|
|
SystemActor.generate_keys_if_needed()
|
2022-11-21 01:29:19 +00:00
|
|
|
|
2022-11-23 00:06:32 +00:00
|
|
|
def ready(self) -> None:
|
|
|
|
post_migrate.connect(self.data_init, sender=self)
|