System check takes so much? Bug?

1,019 views
Skip to first unread message

Oliver Küchler

unread,
Jul 27, 2021, 10:20:29 AM7/27/21
to Django users

Hey guys,

I have already opened a question on StackOverflow, but so far nobody was able to help me out (link: StackOverflow-Link). So I thought I'd give it a try in this group. (And I'm also not sure, whether it's a bug or something else...)

My Problem:

So I set up a webpage/webapplication that is powered by Django. Previously I utilized a MySQL database as backend and everything worked out smooth, but then I tried to switch to PostGreSQL.

When I now try to start the Django-server in the shell it keeps getting stuck when the system checks are performed... From there it takes a very long time (circa 7-8 minutes) with my computer using a lot of CPU until finally the server starts with no issues.

If I run "python -v manage.py check", I can see that Django is getting stuck on 2 things:

  1. import 'django.db.models.sql.compiler' # <_frozen_importlib_external.SourceFileLoader object at 0x7ff640701890>
  2. import 'plotly.express' # <_frozen_importlib_external.SourceFileLoader object at 0x7ff640744d50>
Also I realized that the problem disappears if I comment out python files that use Dash.

I tried to build a very simple app to catch the beginning of the error, but it's really hard to localize and I'm slowly going crazy...

Oliver Küchler

unread,
Jul 30, 2021, 11:35:58 AM7/30/21
to Django users
I further worked on the topic, since I really want to solve it.
I figured out, that the SQL-queries are already performed during "Performing system checks...".
Does that make sense?
However, I still don't understand why it's taking so much time.

For more details and also an minimal example see here:

Oliver Küchler

unread,
Aug 1, 2021, 2:52:37 PM8/1/21
to Django users
Ok, I found the problem:

Apparently Django already executes the SQL-queries during the System check, which are needed to construct the Dash-app (in my case I used [Dash Cytoscape][1]).
And yeah, it was really my database that was to big and therefore causing the queries too take so much time.
Hence it was not PostGreSQL, that was causing the issue...

Thus my solution was to crack down the queries into more efficient requests.

However, I'm still puzzled why I experienced so ambivalent running times depending on which lines I uncommented.
I personally got the impression that the system checks seemed to be rather non-transparent.


**Furthermore:**
If you want to disable/skip the system checks or even the migration checks, then see this StackOverflow entry:
[A solution to system checks on Django server in DEBUG mode][2]


  [1]: https://dash.plotly.com/cytoscape
  [2]: https://stackoverflow.com/questions/41438593/skip-system-checks-on-django-server-in-debug-mode-in-pycharm
Reply all
Reply to author
Forward
0 new messages