Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --pdb and --ipdb options to runserver_plus / all commands? #483

Closed
blueyed opened this issue Mar 21, 2014 · 7 comments
Closed

Add --pdb and --ipdb options to runserver_plus / all commands? #483

blueyed opened this issue Mar 21, 2014 · 7 comments

Comments

@blueyed
Copy link
Contributor

blueyed commented Mar 21, 2014

There is https://github.com/tomchristie/django-pdb, which adds additional options to runserver (which does not appear to work in Django 1.7 anymore).

It uses a middleware to start pdb/ipdb in case of errors.

I think this would be a nice addition to django-extensions.

It would be even better, if these options could be added to all management commands somehow globally (requested for django-pdb in HassenPy/django-pdb#19).

@trbs
Copy link
Member

trbs commented May 12, 2014

I see django-pdb has Python 3 support now.

Happy to consider a Pull Request to merge this functionally into django-extensions if the original author agrees.

@tomchristie
Copy link

Sure, no objection from me 😄

@trbs
Copy link
Member

trbs commented Jun 25, 2015

@blueyed could you setup a Pull Request for this ?

@blueyed
Copy link
Contributor Author

blueyed commented Jun 25, 2015

@trbs
In general, yes - but I'm short on time for things like that currently. Sorry.

@ryneeverett
Copy link
Contributor

I do want this feature, but I'm concerned about the complication this might introduce to django-extensions users. That is, in order for the debugging features to work, django-extensions users would presumably have to follow the installation constraints of django-pdb:

  • Add to INSTALLED_APPS "towards the beginning" in Django>=1.7, otherwise "towards the end".
  • Add to MIDDLEWARE_CLASSES "after all other middleware".

Questions:

  • Can we remove the constraints?
    • If so, shouldn't we do this upstream before trying to integrate?
    • If not, are these constraints acceptable in a popular app that otherwise has no such constraints?
      • If so, then there's no problem and I'm wasting everyone's time.
      • If not, would it be acceptable for these features to be "extra" so the debugging features are disabled if users don't install the optional middleware?

@trbs
Copy link
Member

trbs commented Jun 29, 2015

Maybe we can leverage the django-pdb package ?

That way all constraints from django-pdb will exists if one wants to use it in combination with django-extensions.

For this it would probably be good if we create a custom base Command class for django-extensions so that all commands can 'magically' get support for --pdb.

Maybe django-pdb needs some patches as well so that we can easily hook into it ?

@ryneeverett
Copy link
Contributor

I looked into this again and didn't get very far. However django-pdb seems work fine without manually adding the middleware so my above concerns may be irrelevant:

django_pdb/management/commands/runserver.py:55

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

Since it always needs to be last I don't see what's wrong with relying on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants