Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top