Re: Executing DB-Queries during import

2017-04-04 Thread guettli
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 r

Re: Executing DB-Queries during import

2017-03-29 Thread Simon Charette
> Is it advisable to execute db queries in my AppConfig ready signal handler? AppConfig.ready() is still at module-level. > 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 perfor

Re: Executing DB-Queries during import

2017-03-29 Thread guettli
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 qu

Re: Executing DB-Queries during import

2017-03-23 Thread guettli
Thank you tim for the link. Since on the referenced discussion someone asked for help to debug this, I published my solution here: http://stackoverflow.com/questions/42972444/django-detect-module-level-db-queries/42972445#42972445 I think it would help if you get a RuntimeException if you acces

Re: Executing DB-Queries during import

2017-03-22 Thread 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. On Wednesday, March 22, 2017 at 12:16:16 PM UTC-4, guettli wrote: > > If I recall correctly, the

Executing DB-Queries during import

2017-03-22 Thread guettli
If I recall correctly, then you should not execute db-queries during import. I think this can do a lot of trouble. For example during test-discovery db-queries get executed. Is it just me being paranoid, or is this a general advice? I tried to find something about this topic with my favorite se