Wednesday, March 29, 2017

Re: Executing DB-Queries during import



Am Mittwoch, 22. März 2017 19:20:43 UTC+1 schrieb Tim Graham:
Correct, module level queries should be avoided. Django might try to add some detection to warn about or prohibit that, see https://groups.google.com/d/topic/django-developers/7JwWatLfP44/discussion.


I understand db queries at module-level (aka "import time") should not happen.

When I am allowed to do db queries.

Is it advisable to execute db queries in my AppConfig ready signal handler?

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


--
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/2faead72-9d96-4ec7-85c2-8d5f8e9b8945%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment