Tools for Development and Debugging in Python
Upcoming SlideShare
Loading in...5
×
 

Tools for Development and Debugging in Python

on

  • 2,493 views

 

Statistics

Views

Total Views
2,493
Views on SlideShare
2,468
Embed Views
25

Actions

Likes
11
Downloads
55
Comments
0

6 Embeds 25

http://harajuku-tech.org 11
https://twitter.com 6
http://127.0.0.1 3
http://us-w1.rockmelt.com 2
http://www.linkedin.com 2
http://a0.twimg.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Tools for Development and Debugging in Python Tools for Development and Debugging in Python Presentation Transcript

  • DISQUS Tools and Stu David Cramer twitter.com/zeegFriday, July 15, 2011
  • django-debug-toolbarFriday, July 15, 2011
  • $ pip install django-debug-toolbar # settings.py INSTALLED_APPS = ( debug_toolbar, ) MIDDLEWARE_CLASSES = ( debug_toolbar.middleware.DebugToolbarMiddleware, ) INTERNAL_IPS = (127.0.0.1,)Friday, July 15, 2011
  • Friday, July 15, 2011
  • Friday, July 15, 2011
  • Friday, July 15, 2011
  • Friday, July 15, 2011
  • Extending the Toolbar class SettingsVarsDebugPanel(DebugPanel): """ A panel to display all variables in django.conf.settings """ name = SettingsVars has_content = True def nav_title(self): return _(Settings) def title(self): return _(Settings) def content(self): context = self.context.copy() context.update({ settings: get_safe_settings(), }) return as_string(debug_toolbar/panels/settings.html, context)Friday, July 15, 2011
  • Extending 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, )Friday, July 15, 2011
  • Werkzeug w/ django-devserverFriday, July 15, 2011
  • $ pip install django-devserver # settings.py INSTALLED_APPS = ( devserver, ) $ python manage.py runserverFriday, July 15, 2011
  • Friday, July 15, 2011
  • Friday, July 15, 2011
  • • SQL Queries (Realtime and Summarized) • Profiling (Execution time, Memory Usage) • Cache usage summary • Ajax requests • Session information • Write your own!Friday, July 15, 2011
  • class AjaxDumpModule(DevServerModule): """ Dumps the content of all AJAX responses. """ logger_name = ajax def process_response(self, request, response): if request.is_ajax(): self.logger.info(response.content)Friday, July 15, 2011
  • Extending the Toolbar DEVSERVER_MODULES = ( devserver.modules.sql.SQLSummaryModule, devserver.modules.ajax.AjaxDumpModule’, devserver.modules.profile.ProfileSummaryModule, devserver.modules.request.SessionInfoModule, devserver.modules.profile.MemoryUseModule, devserver.modules.profile.LeftOversModule, devserver.modules.cache.CacheSummaryModule, )Friday, July 15, 2011
  • SentryFriday, July 15, 2011
  • $ pip install django-sentry # settings.py INSTALLED_APPS = ( sentry, sentry.client, )Friday, July 15, 2011
  • Friday, July 15, 2011
  • Friday, July 15, 2011
  • # settings.py MIDDLEWARE_CLASSES = ( sentry.client.middleware.SentryResponseErrorIdMiddleware, ) # 500.html <p>Sorry friends, something’s not working.</p> {% if request.sentry.id %} <p>If you need assistance, you may reference this error as <strong>{{ request.sentry.id }}</strong>.</p> {% endif %}Friday, July 15, 2011
  • Friday, July 15, 2011
  • • Builtin support for Celery • Server/Client (clients can be any language) • 2.x powered by Flask/Redis (no Django)Friday, July 15, 2011
  • GargoyleFriday, July 15, 2011
  • $ pip install gargoyle # settings.py INSTALLED_APPS = ( gargoyle, )Friday, July 15, 2011
  • Friday, July 15, 2011
  • from gargoyle import gargoyle def my_view(request): if gargoyle.is_active(awesome, request): return new happy version :D else: return old sad version :(Friday, July 15, 2011
  • class HostConditionSet(ConditionSet): hostname = String() def can_execute(self, instance): return instance is None def get_field_value(self, instance, field_name): if field_name == hostname: return socket.gethostname() gargoyle.register(HostConditionSet())Friday, July 15, 2011
  • Friday, July 15, 2011
  • Wrap UpFriday, July 15, 2011
  • DISQUS Questions? psst, we’re hiring jobs@disqus.comFriday, July 15, 2011
  • References • Debug Toolbar https://github.com/django-debug-toolbar/django-debug-toolbar • Devserver https://github.com/dcramer/django-devserver • Werkzeug https://github.com/mitsuhiko/werkzeug • Gargoyle https://github.com/disqus/gargoyle • Sentry https://github.com/dcramer/django-sentry (1.x) https://github.com/dcramer/sentry (2.x) code.disqus.comFriday, July 15, 2011