from django.utils.deprecation import MiddlewareMixin

from subdomains.middleware import SubdomainURLRoutingMiddleware
from debug_toolbar.middleware import DebugToolbarMiddleware


class PatchedSubdomainURLRoutingMiddleware(MiddlewareMixin,
                                           SubdomainURLRoutingMiddleware):
    pass


class PatchedDebugToolbarMiddleware(MiddlewareMixin, DebugToolbarMiddleware):
    pass

@@ -45,16 +45,49 @@
 areMixin
+%0Afrom django.conf import settings
 %0A%0Afrom s
@@ -148,68 +148,8 @@
 are%0A
-from debug_toolbar.middleware import DebugToolbarMiddleware%0A
 %0A%0Acl
@@ -292,16 +292,104 @@
  pass%0A%0A%0A
+if settings.DEBUG:%0A    from debug_toolbar.middleware import DebugToolbarMiddleware%0A%0A    
 class Pa
@@ -432,16 +432,56 @@
 reMixin,
+%0A                                       
  DebugTo
@@ -486,29 +486,33 @@
 ToolbarMiddleware):%0A
+    
     pass%0A

Fix debug toolbar in prod issue (#17)