#32167: app.ready() is called after models ready, but the site's urlpatterns are not parsed yet, so how to add code after the whole site is ready? ----------------------------------------+------------------------ Reporter: zencore-cn | Owner: nobody Type: Bug | Status: new Component: Core (Other) | Version: 2.2 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | ----------------------------------------+------------------------ app.ready() is called after models ready, but the site's urlpatterns are not parsed yet, so how to add code after the whole site is ready, so that we can update models and reverse urls?
{{{ from django.apps import AppConfig from django.urls import reverse class Test002Config(AppConfig): name = 'test002' def ready(self): try: url = reverse("admin:auth__user__changelist") print(url) # reverse raise errors except Exception as error: pass # the admin site broken even we try...catch.. here # the admin site can login, but got error in admin index page }}} -- Ticket URL: <https://code.djangoproject.com/ticket/32167> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/053.754361012025861eeccb52f39af9b858%40djangoproject.com.