HassenPy / django-pdb

Gives you `manage.py runserver --pdb` and `manage.py test --pdb`
394 stars 61 forks source link

python manage.py runserver --ipdb error #45

Open wangzhaohe opened 6 years ago

wangzhaohe commented 6 years ago

(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)

HassenPy commented 6 years ago

hey there @wangzhaohe, Thanks for reporting this, it turns out this happens when you use ipdb 0.11, to work around this you should use ipdb 0.10 for now, you can ignore the ShimWanrning too. can you confirm this works with ipdb 0.10?

wangzhaohe commented 6 years ago

It can run into ipdb shel now after pip install ipdb=0.10

But line 67 is not the view line. How can I go to my view line? thanks!


GET /?ipdb 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)

/home/swot/venv/py36dj20/lib/python3.6/site-packages/django/core/handlers/base.py(67)make_view_atomic() 65 66 def make_view_atomic(self, view): ---> 67 non_atomic_requests = getattr(view, '_non_atomic_requests', set()) 68 for db in connections.all(): 69 if db.settings_dict['ATOMIC_REQUESTS'] and db.alias not in non_atomic_requests:

ipdb> /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)

ipdb>

erny commented 4 years ago

The attached fix to PR #49 from @gitaarik works for ipdb 0.12 and ipython 5.8. Thanks.