• Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,161
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
57
Comments
0
Likes
11

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. DISQUS Tools and Stu David Cramer twitter.com/zeegFriday, July 15, 2011
  • 2. django-debug-toolbarFriday, July 15, 2011
  • 3. $ 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
  • 4. Friday, July 15, 2011
  • 5. Friday, July 15, 2011
  • 6. Friday, July 15, 2011
  • 7. Friday, July 15, 2011
  • 8. 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
  • 9. 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
  • 10. Werkzeug w/ django-devserverFriday, July 15, 2011
  • 11. $ pip install django-devserver # settings.py INSTALLED_APPS = ( devserver, ) $ python manage.py runserverFriday, July 15, 2011
  • 12. Friday, July 15, 2011
  • 13. Friday, July 15, 2011
  • 14. • SQL Queries (Realtime and Summarized) • Profiling (Execution time, Memory Usage) • Cache usage summary • Ajax requests • Session information • Write your own!Friday, July 15, 2011
  • 15. 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
  • 16. 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
  • 17. SentryFriday, July 15, 2011
  • 18. $ pip install django-sentry # settings.py INSTALLED_APPS = ( sentry, sentry.client, )Friday, July 15, 2011
  • 19. Friday, July 15, 2011
  • 20. Friday, July 15, 2011
  • 21. # 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
  • 22. Friday, July 15, 2011
  • 23. • Builtin support for Celery • Server/Client (clients can be any language) • 2.x powered by Flask/Redis (no Django)Friday, July 15, 2011
  • 24. GargoyleFriday, July 15, 2011
  • 25. $ pip install gargoyle # settings.py INSTALLED_APPS = ( gargoyle, )Friday, July 15, 2011
  • 26. Friday, July 15, 2011
  • 27. 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
  • 28. 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
  • 29. Friday, July 15, 2011
  • 30. Wrap UpFriday, July 15, 2011
  • 31. DISQUS Questions? psst, we’re hiring jobs@disqus.comFriday, July 15, 2011
  • 32. 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