HassenPy / django-pdb

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

Make it to serve Python 3.6--currently not solving #40

Open ghost opened 6 years ago

ghost commented 6 years ago

Hi Mitch,

maybe when you have time pls update this source code to be compatible with python 3 and the rest of them etc. Currently not working :( and it sucks cos it gaves a lot of errors.

HassenPy commented 6 years ago

Hi there @iocohen,

I ll take a look at this issue this weekend. Also, I'm planning to rewrite the whole project, also dropping support to older django versions and python 2 (freezing them on another branch so they're accessible), so any other suggestions are more than welcome.

Thanks!

HassenPy commented 6 years ago

hey @iocohen, can you please add any traceback to the errors you're getting?

jfw commented 6 years ago

I'm also having issues with it in py3.6, w/ Django 1.11.13, here's a traceback:

Traceback (most recent call last):            
  File "/home/jfw/.virtualenvs/phoneslate/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner                                                               
    response = get_response(request)          
  File "/home/jfw/.virtualenvs/phoneslate/lib/python3.6/site-packages/django/utils/deprecation.py", line 140, in __call__                                                                 
    response = self.get_response(request)     
  File "/home/jfw/.virtualenvs/phoneslate/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner                                                               
    response = response_for_exception(request, exc)                                          
  File "/home/jfw/.virtualenvs/phoneslate/lib/python3.6/site-packages/django/core/handlers/exception.py", line 83, in response_for_exception                                              
    response = debug.technical_500_response(request, *sys.exc_info(), status_code=400)       
TypeError: runpdb() got an unexpected keyword argument 'status_code'                         
Exception occured: <class 'TypeError'>, runpdb() got an unexpected keyword argument 'status_code'                                                                                         
> /home/jfw/.virtualenvs/phoneslate/lib/python3.6/site-packages/django/core/handlers/exception.py(83)response_for_exception()                                                             
     82         if settings.DEBUG:            
---> 83             response = debug.technical_500_response(request, *sys.exc_info(), status_code=400)                                                                                    
     84         else:  

Looks like the method you're replacing w/ runpdb allows for a status_code kwarg: https://github.com/django/django/blob/e8531cc89c878b6a8867498dab266917fef2bff4/django/views/debug.py#L84

gh640 commented 6 years ago

As @jfw told, the error @jfw met seems to be caused when unexpected status_code is passed to runpdb.

https://github.com/HassenPy/django-pdb/blob/8f57b2c722f05d33a4cb6594115659e08173b89f/django_pdb/__init__.py#L10-L19

The replaced function technical_500_response in Django core was changed in the following commit:

https://github.com/django/django/commit/dbbcfca476e29354c3a5c6221112b55741babc14#diff-0c275b0ae46e69a41401fe13da9b1b39L68

Changing the runpdb should solve the issue.