Okupy/Profiling and Debugging

From Gentoo Wiki
< Okupy
Jump to: navigation, search

Profiling

Required packages: hotshot

Option 1

Option 2

Debugging

  • Required packages: django-debug-toolbar
  • Optional packages: https://github.com/django-debug-toolbar/django-debug-toolbar/wiki/3rd-Party-Panels
  • Make sure your IP is listed in the INTERNAL_IPS local.py/development.py settings. If you are working locally this will be: INTERNAL_IPS = ('127.0.0.1',)
  • Add the following middleware to local.py/development.py file:
    FILE local.py or development.py
    MIDDLEWARE_CLASSES = ( 'debug_toolbar.middleware.DebugToolbarMiddleware', )
    
  • Add debug_toolbar to your INSTALLED_APPS setting INSTALLED_APPS = ( 'debug_toolbar', )
  • Add a tuple called DEBUG_TOOLBAR_PANELS to your settings.py file that specifies the full Python path to the panel that you want included in the Toolbar.
    FILE settings.py
    DEBUG_TOOLBAR_PANELS = ( 'debug_toolbar.panels.version.VersionDebugPanel', 'debug_toolbar.panels.timer.TimerDebugPanel',
     'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel', 'debug_toolbar.panels.headers.HeaderDebugPanel',
     'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', 'debug_toolbar.panels.template.TemplateDebugPanel',
     'debug_toolbar.panels.sql.SQLDebugPanel', 'debug_toolbar.panels.signals.SignalDebugPanel', 'debug_toolbar.panels.logger.LoggingPanel', )
    

Reference: https://github.com/django-debug-toolbar/django-debug-toolbar

Front-end profiling

  • Firefox: Shift+F5 to start profiler or Right-click --> Inspect element --> Profiler
  • Features: 3D view, Responsive design mode, times
  • TODO: Chrome Dev tools