1

Stage of models validation is most longest in Django dev-server startup. And in my case it mostly waste of time, since my models сhanging infrequently.

Is there way to turn off this?

Gill Bates
  • 14,330
  • 23
  • 70
  • 138

1 Answers1

1

This is not possible without modifying the source code of Django (which is not recommended). The only validation Django does on start-up is to check if the syntax of your model code is okay or not. It should not take more than 2-3 seconds. So, there are few other initialization are being done during startup which are also taking time.

During development, you do not need to restart the server every time you modify the code- especially if you are not touching the definition of the models at all. The Django dev server automatically reloads itself if it detects any change in your code. So, leave it running while you develop and hopefully your experience will improve.

Nilanjan Basu
  • 828
  • 9
  • 20
  • 2
    Actually, if one follows your advice it is even MORE annoying with the model validation! In any case, one can just uncomment the line "self.validate(display_num_errors=True)" in django/core/management/commands/runserver.py – boxed Jan 17 '14 at 10:36
  • Your comment actually doesn't seem to turn off the delay with validation, only the message. Is that right or am I mistaken? – jesuis Mar 13 '14 at 22:31
  • Okay I am mistaken. However, the printout of "validating models" is misleading in terms of the delay. The validation is not the source of the delay as commenting it out does not speed the servers responsiveness. It must be elsewhere. – jesuis Mar 13 '14 at 22:46
  • Mistaken again! It is the validation. However, commenting it out did nothing for me, oddly. I realize that makes no sense ;) – jesuis Mar 13 '14 at 22:52
  • I never timed it, but on my mac there must be at least two delays, one from self.validate(), the other elsewhere. – jesuis Mar 13 '14 at 22:53
  • In my system it's somewhere in SocketServer._eintr_retry() – jesuis Mar 13 '14 at 23:00