Friday, December 2, 2016

Re: wsgiref - When does the complexity of question require posting to the Developers or other forums?

Thanks for the reply.

I agree the probability of this being a bug in Django is improbable still I found git hub django 
bug descriptions/discussions which URLs are listed in previous posts. Both of those URLs
listed patches to fix the situation, not directly in Django but in the WsgiRef component. 
https://github.com/django/django/commit/2f615b10e6330d27dccbd770a4628200044acf70
https://github.com/django/django/commit/742ea51413b3aab07c6afbfd1d52c1908ffcb510

I naturally referred to them being as could not find after search of the internet or this forum any further info.

It would be better if traceback pointed to my code but instead Traceback now points to 
/usr/lib/python2.7/site-packages/django/core/handlers/base.py
with the same attribute error. 'NoneType' object has no attribute 'render'.
(SEE Traceback below)

With so much of this troubleshooting being in finding the right question. 
* Would issue perhaps be limited to Django's built-in development server?
* Would using a difference Web Interface Gateway solution solve the problem?

Details follow...

Please advise  


I type on the Linux server command line....
# python manage.py runserver 0.0.0.0:8000
then point my browser to...
http://[MyDevelopmentServerIP]:8000/

And get the following response.

Environment:      Request Method: GET  Request URL: http://MyServer:8000/    Django Version: 1.6.12  Python Version: 2.7.5  Installed Applications:  ('django.contrib.auth',   'django.contrib.contenttypes',   'django.contrib.sessions',   'django.contrib.sites',   'django.contrib.admin',   'django.contrib.humanize',   'django.contrib.redirects',   'bookstor.books',   'bookstor.registration',   'bookstor.profiles',   'django_extensions',   'django.contrib.admin',   'bookstor.cart')  Installed Middleware:  ('django.middleware.common.CommonMiddleware',   'django.contrib.sessions.middleware.SessionMiddleware',   'django.middleware.common.CommonMiddleware',   'django.middleware.csrf.CsrfViewMiddleware',   'django.contrib.auth.middleware.AuthenticationMiddleware',   'django.middleware.transaction.TransactionMiddleware',   'django.contrib.messages.middleware.MessageMiddleware',   'django.contrib.redirects.middleware.RedirectFallbackMiddleware')      Traceback:  File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response    94.                 response = response.render()    Exception Type: AttributeError at /  Exception Value: 'NoneType' object has no attribute 'render'



On Thursday, December 1, 2016 at 7:28:48 PM UTC+1, Daniel Roseman wrote:
On Thursday, 1 December 2016 13:16:07 UTC, NoviceSortOf wrote:


Hi All,

After hours of looking for solutions, here on Stackoverflow, GitHub, Django site and other forums,
and seeing that at least 2 other posts related to what per web chatter appears to be a known
bug in Django and the WSGI package, I'm wondering where to turn for useful advice
regarding what appears to be a common problem without a common answer.

Below is detail of a wsgiref issue that gets considerable discussion online with
no answer to the question being posted here or elsewhere.

* Should I attempt posting this question in the Developers Conf?
* Are there other forums that might be of help?

Please advise 



Details of well known Wsgiref bug/issue follow.

*******************************************************************************
After porting my project to the new development area...
When running... 
 python manage.py runserver 0.0.0.0:8000

And then loading a page on a browser I get the following.

********************************************************************************
  File "/usr/lib64/python2.7/wsgiref/simple_server.py", line 33, in close
   self.status.split(' ',1)[0], self.bytes_sent
   AttributeError: 'NoneType' object has no attribute 'split'
********************************************************************************

This problem points to the wsgi component of the install packages.

Researching the web various solutions are posted, including ...
----------------------------------------------------------------------------------
* Commenting out line 33 in simple_server.py and see if any missing
   packages are reported.
   (I've tried this and no packages are reported as missing)

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
* A Django bug report, with code that does not match the version I currently
  am using. It recommends modifications to file  
  django/core/handlers /exception.py 
  which does not exist on the release currently installed.

------------------------------------------------------------------------------------
* A Django modification that makes perfect sense and partially matches the revision of django/core/handlers/base.py on my installed system.

-------------------------------------------------------------------------------------

Still though I continue to get 'NoneType' object has no attribute 'render' or
other errors related to NoneType assigned as NoneType object when it should
be a request response object.

*** What to do?

* This appears to be a bug noted in Django, Github and Stackoverflow communities,
  with Wsgi related to various versions of Django and Python 
  
  _Is there any logical way of resolving the NonType error, by settings.py or other
   Django config options?
  
  _Would placing my app as the home page on this development server rather than 
   relying on the python manage.py runserver possibly resolve this problem?
  
  _Is there an alternative to Wsgi that would possibly eliminate the problem?
  

Any ideas or suggestions appreciated.



It seems pretty unlikely that there is a fundamental bug in Django which means it cannot serve pages via WSGI; I would imagine that that would have been noticed by others, including the core developers, before now.

So it is almost certain that the bug is in your code, which you have not shown. You also need to show the full traceback.
--
DR.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2bcd4d79-3b7e-4cb6-bac2-0778f308b666%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment