Skip to content

Commit

Permalink
Merge pull request #42 from gh640/fix_no_attribute_MIDDLEWARE_CLASSES…
Browse files Browse the repository at this point in the history
…_error

Issue #41: Fix MIDDLEWARE_CLASSES error with `runserver`
  • Loading branch information
HassenPy authored Mar 1, 2018
2 parents a192e51 + 360bffb commit 1652b7a
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 1652b7a

Please sign in to comment.