Skip to content

Commit

Permalink
Issue HassenPy#41: Fix MIDDLEWARE_CLASSES error with runserver on d…
Browse files Browse the repository at this point in the history
…jango >= 1.10.
  • Loading branch information
gh640 committed Feb 28, 2018
1 parent a192e51 commit 360bffb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions django_pdb/management/commands/runserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ def handle(self, *args, **options):
pdb_option = options.pop('pdb')
ipdb_option = options.pop('ipdb')

middleware = 'django_pdb.middleware.PdbMiddleware'
pdb_middleware = 'django_pdb.middleware.PdbMiddleware'
middleware = (settings.MIDDLEWARE
if hasattr(settings, 'MIDDLEWARE')
else settings.MIDDLEWARE_CLASSES)
if ((pdb_option or settings.DEBUG)
and middleware not in settings.MIDDLEWARE_CLASSES):
settings.MIDDLEWARE_CLASSES += (middleware,)
and pdb_middleware not in middleware):
middleware += (pdb_middleware,)

self.pm = options.pop('pm')
if self.pm:
Expand Down

0 comments on commit 360bffb

Please sign in to comment.