Django: model slippage

I am using development server ( runserver

) in Django and it started to annoy me that Django checks the models every time I save the file and the server restarts. I have ~ 8000 records in my SQLite3 database and it takes up to five seconds to validate the models. I'm not familiar with how Django validates models, but my guess is that it is proportional to the size of the database.

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

+2


source to share


2 answers


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



Try pressing Control + C while it's 5 seconds and see where the code is when the KeyboardException is thrown.

+2


source


Django does not perform model-level validations at all, and of course it does not scan your database at startup.



The only check it does at startup is to check the syntax of your model code and not exactly proportional to the size of your database.

+5


source







All Articles