Giter Club home page Giter Club logo

django-pdb's People

Contributors

blueyed avatar demianbrecht avatar gh640 avatar goinnn avatar hassenpy avatar johnjohndoe avatar jpulec avatar pielgrzym avatar psycojoker avatar rpatterson avatar schinckel avatar seddonym avatar sfllaw avatar shearichard avatar tomchristie avatar yhlam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-pdb's Issues

Runserver Issue with Django 3.6.x - middleware being None

Had an issue where middleware wasn't honoured in django 3.6.3. Stock install from pypi fails with the error below. This fixes that.

Traceback (most recent call last):
File "./manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/home/chayim/.venvs/python/3.6.3.siemphony.core.master/lib/python3.6/site-packages/django/core/management/init.py", line 364, in execute_from_command_line
utility.execute()
File "/home/chayim/.venvs/python/3.6.3.siemphony.core.master/lib/python3.6/site-packages/django/core/management/init.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/chayim/.venvs/python/3.6.3.siemphony.core.master/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/chayim/.venvs/python/3.6.3.siemphony.core.master/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 62, in execute
super(Command, self).execute(*args, **options)
File "/home/chayim/.venvs/python/3.6.3.siemphony.core.master/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/chayim/.venvs/python/3.6.3.siemphony.core.master/lib/python3.6/site-packages/django_pdb/management/commands/runserver.py", line 62, in handle
if middlware is None:

Working with devserver (or apps that override runserver)

I use django-devserver, which also replaces runserver.

You should document that in order to use django_pdb with something that overrides runserver (or test), you can just do:

MIDDLEWARE_CLASSES += ('django_pdb.middleware.PdbMiddleware',)

And ensure that django_pdb is installed before the other app that overrides the runserver command.

(Being able to --werkzeug with devserver makes it fully awesome).

Fork guidance

Hi Tom (and co),

I've forked this project to
https://github.com/0atman/django-pdb-pudb
And done little more than s/pdb/pudb

I wanted to reach out to you and the community to make sure I'm doing the right thing with attribution, I've not done much to add value to the code!
I've also dropped it on PyPi for convenience. https://pypi.python.org/pypi/django-pdb-pudb

I've been using django-pdb for a while, and I'm really please to integrate my new favourite tool, pudb! Thanks for your help guys :-)

python manage.py runserver --ipdb error

(py36dj20) swot@pp:~/pp/zlhopesun$ python manage.py runserver --ipdb
Performing system checks...

System check identified no issues (0 silenced).
May 06, 2018 - 02:15:34
Django version 2.0.4, using settings 'XService.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

GET /custom_login/
function "LoginView" in generic/base.py:54
args: ()
kwargs: {}

/home/swot/venv/py36dj20/lib/python3.6/site-packages/IPython/frontend.py:21: ShimWarning: The top-level frontend package has been deprecated since IPython 1.0. All its subpackages have been moved to the top IPython level.
"All its subpackages have been moved to the top IPython level.", ShimWarning)
Internal Server Error: /custom_login/
Traceback (most recent call last):
File "/home/swot/venv/py36dj20/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "/home/swot/venv/py36dj20/lib/python3.6/site-packages/django/core/handlers/base.py", line 119, in _get_response
response = middleware_method(request, callback, callback_args, callback_kwargs)
File "/home/swot/venv/py36dj20/lib/python3.6/site-packages/django_pdb/middleware.py", line 83, in process_view
p = get_ipdb()
File "/home/swot/venv/py36dj20/lib/python3.6/site-packages/django_pdb/utils.py", line 15, in get_ipdb
return ipdb.main.Pdb(def_colors)
AttributeError: module 'ipdb.main' has no attribute 'Pdb'
[06/May/2018 02:19:18] "GET /custom_login/ HTTP/1.1" 500 82881
/home/swot/venv/py36dj20/lib/python3.6/site-packages/IPython/html.py:14: ShimWarning: The IPython.html package has been deprecated since IPython 4.0. You should import from notebook instead. IPython.html.widgets has moved to ipywidgets.
"IPython.html.widgets has moved to ipywidgets.", ShimWarning)

'PdbMiddleware' object is not callable

Hello

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/django/core/handlers/exception.py", line 39, in inner
    response = get_response(request)
TypeError: 'PdbMiddleware' object is not callable

Django: 1.10.3 / Django-Pdb: 0.5.1

INSTALLED_APPS = [
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'devices',
    'rest_framework',
    'django_pdb'
]
MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django_pdb.middleware.PdbMiddleware',
]

Thank you

Break into current frame on SIGINT

It would be nice if I could press Ctrl-C to break into the running code.

This would be really helpful for example in debugging complicated or long-running views.

Does not work with static_files app

Hi

I tested your app - seems great, but it does not currently work with django 1.2/1.3 static files apps. Could you update it to do so?

Thanks

Tim

ipdb?

Just wondering if this works with ipdb as well? TIA

package need to update for high ipdb version

File "/xx/lib/python3.6/site-packages/django_pdb/utils.py", line 15, in get_ipdb return ipdb.__main__.Pdb(def_colors)
AttributeError: module 'ipdb.__main__' has no attribute 'Pdb'

test not ok when: pip install ipdb >=0.11

test ok when: pip install ipdb==0.10

Tag confusion

The latest releases on PyPI are 0.6.2, 0.6.1, 0.5.1

The latest tags here are v6.1, v6.0, 0.4.1

I assume tag v6.1 == PyPI 0.6.1.

And that PyPI 0.6.2 has no tag on Github.

argparse.ArgumentError: argument --pdb: conflicting option string: --pdb

The tests are failing on Django 3.x

+ python3 testproject/manage.py test
Traceback (most recent call last):
  File "testproject/manage.py", line 9, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python3.8/site-packages/django/core/management/commands/test.py", line 23, in run_from_argv
    super().run_from_argv(argv)
  File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 322, in run_from_argv
    parser = self.create_parser(argv[0], argv[1])
  File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 296, in create_parser
    self.add_arguments(parser)
  File "/home/abuild/rpmbuild/BUILDROOT/python-django-pdb-0.6.2-12.1.x86_64/usr/lib/python3.8/site-packages/django_pdb/management/commands/test.py", line 39, in add_arguments
    parser.add_argument(name, **kwargs)
  File "/usr/lib64/python3.8/argparse.py", line 1386, in add_argument
    return self._add_action(action)
  File "/usr/lib64/python3.8/argparse.py", line 1749, in _add_action
    self._optionals._add_action(action)
  File "/usr/lib64/python3.8/argparse.py", line 1590, in _add_action
    action = super(_ArgumentGroup, self)._add_action(action)
  File "/usr/lib64/python3.8/argparse.py", line 1400, in _add_action
    self._check_conflict(action)
  File "/usr/lib64/python3.8/argparse.py", line 1539, in _check_conflict
    conflict_handler(action, confl_optionals)
  File "/usr/lib64/python3.8/argparse.py", line 1548, in _handle_conflict_error
    raise ArgumentError(action, message % conflict_string)
argparse.ArgumentError: argument --pdb: conflicting option string: --pdb

Update PYPA package to most/more recent version.

Hey there! Cheers for the package, looking forward to using it, I noticed that #42 was merged in March but the releases on Github list the last official release as happened in July 2017. Can we get a version bump for those of us using pip/pipenv?

Thanks mate.

Accessing improved debugging features from django-pdb

Django-pdb works fine, but I have a custom .pythonrcfile which allows nice features like autocomplete when I set_trace manually. Any ideas on how I can pull this off with python manage.py test --pdb?

If you can give me a place to start I can try and see if I can create a fix for it myself. Thanks for all you do!

Easier debugging for class based views

If a CBV is debugged using the pdb or ipdb GET parameter, the console drops into the debugger in the view() function inside the django.views.generic.base.View.as_view() method closure. It takes a few careful steps to end up in actual view code of the application.

Off the top of my head, I can't think of an easy way to make it run a little further and only break when view code outside the Django core is entered. However, it would be very useful if that was possible.

`runserver` command doesn't start with django 2.0.2

After installing this package, runserver commands raises the following error related with MIDDLEWARE_CLASSES.

python manage.py runserver
Traceback (most recent call last):
  File "site/manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/(the path)/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/(the path)/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/(the path)/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/(the path)/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 62, in execute
    super().execute(*args, **options)
  File "/(the path)/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "/(the path)/lib/python3.6/site-packages/django_pdb/management/commands/runserver.py", line 61, in handle
    middleware = settings.MIDDLEWARE_CLASSES
  File "/(the path)/lib/python3.6/site-packages/django/conf/__init__.py", line 57, in __getattr__
    val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'MIDDLEWARE_CLASSES'

My environment is:

  • Python 3.6.4
  • Django 2.0.2

This may be related to #40. Thank you in advance.

manage.py test broken on Python 2.6 with unittest2 installed

Steps to reproduce:

  • Enable django-pdb in a project
  • Run manage.py test

The following traceback is generated:

Traceback (most recent call last):
  File "./manage.py", line 14, in <module>
    execute_manager(settings)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/__init__.py", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/__init__.py", line 67, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django_pdb-0.1.2-py2.6.egg/django_pdb/management/commands/test.py", line 2, in <module>
    from django_pdb.testrunners import PdbTestSuiteRunner
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django_pdb-0.1.2-py2.6.egg/django_pdb/testrunners.py", line 70, in <module>
    class PdbTestResult(ExceptionTestResultMixin, unittest._TextTestResult):
AttributeError: 'module' object has no attribute '_TextTestResult'

This can be fixed in one of two ways:

  • Doing from django.utils import unittest instead of import unittest, and depending on Django >= 1.3.
  • Doing if sys.version_info[:2] < (2, 7): import unittest2 as unittest and depending on unittest2 if Python version is less than 2.7.

Unable to make it work on Django 1.10.3

Hi,

I'm unable to make it work with my django 1.10.3 setup.

I have added it to top of the INSTALLED_APPS.

INSTALLED_APPS = [
    'django_pdb',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'django_countries',
    'haystack',

and have added middleware class at the end :

MIDDLEWARE_CLASSES += ('django_pdb.middleware.PdbMiddleware',)

When I run it python manage.py runserver 0.0.0.0:8000 --pdb, it doesn't drop me into pdb shell.

Can anyone please help me in debugging why it's not working ? Is it a bug ? Or is it a configuration issue at my end ?

Regards,
Ashish Bansal

Incompatible with other process_view middleware?

Breakpoints never seem to be hit when another middleware class returns a response, which makes sense given the docs:

If it returns an HttpResponse object, Django won’t bother calling any other view or exception middleware, or the appropriate view

Is this a known limitation?

Error after django upgrade to 4.1

AttributeError: 'PdbMiddleware' object has no attribute '_is_coroutine'
seems to be coming from not calling super().__init__() in the PdbMiddleware
I added line 41 - first line in the __init__functon:

    def __init__(self, get_response=None, debug_only=True):
        """
        If debug_only is True, this middleware removes itself
        unless settings.DEBUG is also True. Otherwise, this middleware
        is always active.
        """
        super().__init__(get_response)
        self.get_response = get_respose
        if debug_only and not settings.DEBUG:
            raise MiddlewareNotUsed()

that in turn calls _async_check() correctly from class deprecation.MiddlewareMixin

Project abandoned?

Hello, I'd like to know if the project is still active. If not, I'd love to be a maintainer and update and add new features.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.