views:

122

answers:

2

Hi

I'm using the development server (runserver) in Django and it's started to annoy me that Django is validating the models every time I save a file and the server restarts. I have ~8000 entries in my SQLite3 database and it takes up to five seconds to validate the models. I'm not familiar with how Django validates the models, but I'm guessing it's proportional to the size of the database somehow.

So is there any way to tell Django not to validate the models? The ideal thing would be being able to tell Django to validate the models only on the first start and not on any automatic restarts due to changes in the Python files.

+3  A: 

Django doesn't do any model-level validation at all, and it certainly doesn't scan your database on startup.

The only validation it does on startup is to check the syntax of your models code, and that's not at all proportional to your database size.

Daniel Roseman
Actually, I just noticed that what takes the longest time is the delay between me hitting Enter in the terminal and the start of model validation. It takes about three seconds before it starts validating anything and after that it takes about two seconds to validate the models.
Deniz Dogan
A: 

I have over 10 million rows in my database, and runserver takes less than a second.

Try hitting Control + C while it is in the 5 seconds, and see where the code is when the KeyboardException is thrown.

Paul Tarjan
Why the downvote? (as if the person will comment)
Paul Tarjan