This repository has been archived on 2023-09-24. You can view files and clone it, but cannot push or open issues or pull requests.
takahe/users/apps.py

21 lines
596 B
Python
Raw Normal View History

2022-11-05 21:17:27 +01:00
from django.apps import AppConfig
from django.db.models.signals import post_migrate
2022-11-05 21:17:27 +01:00
class UsersConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "users"
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()
def ready(self) -> None:
post_migrate.connect(self.data_init, sender=self)