Skip to main content

debugtoolbar for aiohttp

Project description

.. image::
:alt: |Build status|
.. image::
:alt: |Coverage status|

**aiohttp_debugtoolbar** provides a debug toolbar for your aiohttp_
web application. Library is port of pyramid_debugtoolbar_ and
still in early development stages. Basic functionality has been

* basic panels
* intercept redirects
* intercept and pretty print exception
* interactive python console
* show source code

.. image::

Ported Panels
``HeaderDebugPanel``, ``PerformanceDebugPanel``, ``TracebackPanel``,
``SettingsDebugPanel``, ``MiddlewaresDebugPanel``, ``VersionDebugPanel``,
``RoutesDebugPanel``, ``RequestVarsDebugPanel``, ``LoggingPanel``

Help Needed
Are you coder looking for a project to contribute to
python/asyncio libraries? This is the project for you!

Install and Configuration

$ pip install aiohttp_debugtoolbar

In order to plug in ``aiohttp_debugtoolbar`` you have to attach middleware to
your ``aiohttp.web.Application``, and call ``aiohttp_debugtoolbar.setup``

.. code:: python

import aiohttp_debugtoolbar
app = web.Application(loop=loop,

Full Example

.. code:: python

import asyncio
import jinja2
import aiohttp_debugtoolbar
import aiohttp_jinja2

from aiohttp import web

def basic_handler(request):
return {'title': 'example aiohttp_debugtoolbar!',
'text': 'Hello aiohttp_debugtoolbar!',

def exception_handler(request):
raise NotImplementedError

def init(loop):
# add aiohttp_debugtoolbar middleware to you application
app = web.Application(loop=loop,
# install aiohttp_debugtoolbar

template = """
<title>{{ title }}</title>
<h1>{{ text }}</h1>
<a href="{{ app.router['exc_example'].url() }}">
Exception example</a>
# install jinja2 templates
loader = jinja2.DictLoader({'index.html': template})
aiohttp_jinja2.setup(app, loader=loader)

# init routes for index page, and page with error
app.router.add_route('GET', '/', basic_handler, name='index')
app.router.add_route('GET', '/exc', exception_handler,

handler = app.make_handler()
srv = yield from loop.create_server(handler, '', 9000)
print("Server started at")
return srv, handler

loop = asyncio.get_event_loop()
srv, handler = loop.run_until_complete(init(loop))
except KeyboardInterrupt:

I've borrowed a lot of code from following projects. I highly recommend to check them out:

* `pyramid_debugtoolbar <>`_
* `django-debug-toolbar <>`_
* `flask-debugtoolbar <>`_

Play With Demo


* Python_ 3.3+
* asyncio_ or Python_ 3.4+
* aiohttp_
* aiohttp_jinja2_

.. _Python:
.. _asyncio:
.. _aiohttp:
.. _aiopg:
.. _aiomysql:
.. _aiohttp_jinja2:
.. _pyramid_debugtoolbar:


0.0.5 (2015-09-13)

* Fixed IPv6 socket family error (Thanks @stormandco!)

0.0.4 (2015-09-05)

* Fixed support for aiohttp>=0.17. (Thanks @himikof!)

0.0.3 (2015-07-03)

* Switched template engine from mako to jinja2. (Thanks @iho!)

* Added custom *yield from* to track context switches inside coroutine.

* Implemented panel for collecting request log messages.

* Disable toolbar code injecting for non web.Response answers
(StreamResponse or WebSocketResponse for example) #12

0.0.2 (2015-05-26)

* Redesign UI look-and-feel

* Rename `toolbar_middleware_factory` to just `middleware`.

0.0.1 (2015-05-18)

* Initial release.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiohttp_debugtoolbar-0.0.5.tar.gz (414.1 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page