0

We are handling a very large django codebase, we are using django debug toolbar, the problem is so weird, if I put DEBUG_TOOLBAR=True in my django.settings , I am not able to perform any activity with manage.py like python manage.py runserver or python manage.py collectstatic any of it. When I press CTRL+C to terminate, I am unable to, it got stuck there. Here is my django debug toolbar configuration.

DEBUG=True
DEBUG_TOOLBAR = True
if DEBUG and DEBUG_TOOLBAR:
    INSTALLED_APPS += (
        'debug_toolbar',
    )
    INTERNAL_IPS = (
        '127.0.0.1',
        'XX.XX.XXX.XXX',
    )
    DEBUG_TOOLBAR_PANELS = [
            'debug_toolbar.panels.timer.TimerPanel',
            'debug_toolbar.panels.sql.SQLPanel',
            'debug_toolbar.panels.cache.CachePanel',
            'debug_toolbar.panels.signals.SignalsPanel',
            'debug_toolbar.panels.redirects.RedirectsPanel',
            ]
    DEBUG_TOOLBAR_CONFIG = {
        'RENDER_PANELS': True,
        'RESULTS_CACHE_SIZE': 2,
        'RESULTS_STORE_SIZE': 10, # Required for ddt_request_history
        'SHOW_TOOLBAR_CALLBACK': lambda request: True
            }

    MIDDLEWARE_CLASSES += (
        'saul.middleware.profile.ProfileMiddleware',
        'debug_toolbar.middleware.DebugToolbarMiddleware',
    )

However, I have gone through the answers of below question, but none of it worked.

django-debug-toolbar not showing up

  • What do you mean "unable to"? Is there an error message? What is it? – Adam Barnes Oct 25 '17 at 12:52
  • @AdamBarnes there is no error message on it.... – lokesh sanapalli Oct 25 '17 at 13:32
  • So when typing `python manage.py shell` and pressing Enter, you just get a cursor and nothing else? No error, no prompt? What happens if you just type `python` and press Enter? – Adam Barnes Oct 25 '17 at 16:03
  • @AdamBarnes even shell is not working... it doesn't print any error, nothing... if I type `python` it enters `python` console – lokesh sanapalli Oct 26 '17 at 06:26
  • My guess is that you have an infinite loop somewhere in your settings, which would cause python to just spin and never print anything when you use a management command. Are you able to post more of your code? If the project isn't sensitive, could you put it on github for us to have a look? – Adam Barnes Oct 30 '17 at 10:05
  • @AdamBarnes OOPS!!! sorry barnes... the project is private... it is our entire codebase.... really thanks for helping, I will look into this... – lokesh sanapalli Oct 30 '17 at 12:28
  • Ok, try running `manage.py shell` while watching `top`, and seeing if `python` jumps to the top of the CPU utilisation list. That would indicate a loop. – Adam Barnes Oct 30 '17 at 12:30
  • @AdamBarnes Hi, Yes python has topped up and my aws instance checks failed due to high CPU utilization, have to figure out why... – lokesh sanapalli Oct 31 '17 at 08:56
  • Search your settings files for a `while` or `for`. Make sure that it terminates. – Adam Barnes Oct 31 '17 at 09:43
  • @AdamBarnes If there's a infinte loop in settings, it's working if I made `DEBUG_TOOLBAR=False` without any changes to settings. – lokesh sanapalli Nov 02 '17 at 08:24
  • That's perplexing then; nothing in that block suggests anything like this could happen. I'd personally now go and comment out a line at a time, and try the shell after each, to see what's causing it. I'd even go as far as to comment out single values in the config lists, so, for instance, only comment out `'saul.middleware.profile.ProfileMiddleware'`... – Adam Barnes Nov 02 '17 at 11:18
  • Sure... let me try... Thanks you very much for your help!!! @AdamBarnes – lokesh sanapalli Nov 02 '17 at 11:23

1 Answers1

0

Finally, found the answer that we have an infinite loop of DEBUG_TOOLBAR set in our multiple settings file, so it's causing a loop there.