Django slow autoreload due to check_url_config system check
<p>My load and autoreload on python manage.py runserver is taking a lot of time. (25seconds+). I did a bit of digging and it seems to be stuck on "Performing system checks..". To investigate more, I added timer on each of the check functions.</p>

<pre><code>C:\Programs\Python35-32\python.exe manage.py runserver
Performing system checks...

self.check: check_default_cache_is_configured 0.0
self.check: check_duplicate_template_settings 0.0
self.check: check_all_models 0.028018712997436523
self.check: check_model_signals 0.0
self.check: check_setting_app_dirs_loaders 0.0
self.check: check_url_config 25.260559558868408
self.check: check_admin_app 0.0
self.check: check_user_model 0.0
self.check: check_generic_foreign_keys 0.0010006427764892578
System check identified no issues (0 silenced).
self.check: 25.289578914642334
self.check_migrations: 0.08856558799743652
June 28, 2016 - 15:43:08
Django version 1.9.6, using settings 'mar16_cookifi_com.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
</code></pre>

<p>I found that in check\urls.py, resolver.url_patterns is taking a long time.</p>

<pre><code>def check_resolver(resolver):
    """
    Recursively check the resolver.
    """
    from django.core.urlresolvers import RegexURLPattern, RegexURLResolver
    warnings = []
    for pattern in resolver.url_patterns:
        if isinstance(pattern, RegexURLResolver):
</code></pre>

<ol>
<li><p>I am not sure how urlresolver.url_patterns is taking a long time. I would appreciate some help in understanding why it takes 25 seconds to load the url_patters. What can I do to reduce this.</p></li>
<li><p>At the very least, I would like to disable check_url_config. Solution for 1 is more preferred.  </p></li>
</ol>

<p>Added:</p>

<p>I manually disabled the check function in django code. 
[Edit] Actually it just delayed the problem to the first load, which took 25 seconds.</p>

<pre><code>@register(Tags.urls)
def check_url_config(app_configs, **kwargs):
    return []
    if getattr(settings, 'ROOT_URLCONF', None):
        from django.core.urlresolvers import get_resolver
        resolver = get_resolver()
        return check_resolver(resolver)
    return []
</code></pre>

<p>The time reduces to sub second:</p>

<pre><code>C:\Programs\Python35-32\python.exe manage.py runserver
Performing system checks...

self.check: check_default_cache_is_configured 0.0
self.check: check_duplicate_template_settings 0.0
self.check: check_all_models 0.028048038482666016
self.check: check_model_signals 0.0
self.check: check_setting_app_dirs_loaders 0.0
self.check: check_url_config 0.0
self.check: check_admin_app 0.0
self.check: check_user_model 0.0
self.check: check_generic_foreign_keys 0.0
System check identified no issues (0 silenced).
self.check: 0.028048038482666016
self.check_migrations: 0.06304526329040527
June 28, 2016 - 16:24:36
Django version 1.9.6, using settings 'mar16_cookifi_com.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
</code></pre>

<p>But i would like to have a solution where I do not modify django code.</p>

<p><strong>After 1 more hour:</strong></p>

<p>Found the cause of the problem. The url file is loading all our views. One of the view recently added a ML module which takes 25 seconds to train. Making the ML module lazy reduced the loading time to a second.</p>