Okupy/Profiling and Debugging

Profiling
Required packages: hotshot

Option 1

 * Create a new file and name it 'middleware.py'.
 * Add the following code: https://gist.github.com/Miserlou/3649773/raw/72e73609e67f70faaa31c73f25911ba15e384d54/middleware.py
 * In the MIDDLEWARE_CLASSES of your local.py/development.py, include the line. 'okupy.accounts.middleware.ProfileMiddleware',
 * To use the profiler, simply add the string '?prof' to the end of your URL. e.g. http://127.0.0.1:8000/devlist/?prof
 * Reference: https://gun.io/blog/fast-as-fuck-django-part-1-using-a-profiler/

Option 2

 * Follow this guide: https://code.djangoproject.com/wiki/ProfilingDjango

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: 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.

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