Django "Performing System Checks" is running very slow

Issue

Out of nowhere I’m running into an issue with my Django application where it runs the “Performing System Checks” command very slow. If I start the server with

python manage.py runserver

It takes more then a minute or two for the server to actually start up. After that it works fine until I make an update and then it restarts the server and goes through the process of “performing system checks” again taking a few minutes to complete.

If I run

python -v manage.py check

It gets to this import

import 'netrc' # <_frozen_importlib_external.SourceFileLoader object at 0x11dce6748>

And then it just hangs for a minute or so and then continues fine.

If I run

python -v manage.py runserver

It runs through a list of imports and the sits on “Performing System Checks” for awhile and eventually continues on to start the server.

I’m running Django 2.1.1. Using ‘PYENV’ to manage different python versions and running this in a virtual environment. I read on a few other posts that this has something to do with installing MySQL version 5.7, which is something I did recently, but I went through and uninstalled it as completely as I causing HomeBrew and removing other references.

I’ve re-created my virtual environment. Reinstalled Python 3.6.0. I’ve tried using Python 3.6.4. None of that has helped.

This is a pretty big issue because I can’t wait a few minutes between every update.

Solution

I found the culprit. I have multiple settings files for different environments. That are set based on the environment variables. In order to grab the IP address from my elasticbeanstalk instances to add it to the allowed_hosts I was importing the requests library in one of my settings files. If I remove that it works as normal.

Answered By – James Parker

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published