Tuesday, April 4, 2017

Re: Executing DB-Queries during import



Am Donnerstag, 30. März 2017 00:55:40 UTC+2 schrieb Simon Charette:
> Is it advisable to execute db queries in my AppConfig ready signal handler?

AppConfig.ready() is still at module-level.


ok. Good to know.

 
> Use case: I want to add URL patterns which get collected from db rows.

It might be more appropriate to define an URL resolver (an object like django.conf.url)
that performs queries at resolve()/reverse() time instead.

A simpler solution could be to define a catch all view like django-cms does and
perform the routing inside the view.


Yes, you are right. This looks like a good solution.

Thank you very much for sharing your knowledge.

Regards,
  Thomas Güttler

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1fc1e608-6b63-420e-b9b4-a45f2e3ae5c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment