[pyar] Chat con Django Channels

Marco Moresi mrc.moresi en gmail.com
Dom Abr 2 23:09:46 ART 2017


Buenas, como andan? les escribo por que estoy tratando de introducirme en
el mundo de Channels con django, entonces empecé a escribir una app para
django que es un chat en tiempo real dentro de un proyecto, seria como mi
hola mundo! para channels. Pero estoy teniendo un problema, el chat
funciona bien pero el login del admin no funciona, me esta tirando internal
Error 500 por lo tanto no me deja logearme con el admin, el chat funciona,
me parece que estoy teniendo un problema con el settings.py.

[2017/04/01 23:58:36] HTTP GET /admin/ 302 [0.03,
127.0.0.1:45030][2017/04/01 23:58:36] HTTP GET /admin/login/ 200
[0.04, 127.0.0.1:45030]Internal Server Error: /admin/login/Traceback
(most recent call last):
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/core/handlers/exception.py",
line 39, in inner
    response = get_response(request)
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/core/handlers/base.py",
line 178, in _get_response
    response = middleware_method(request, callback, callback_args,
callback_kwargs)
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/middleware/csrf.py",
line 260, in process_view
    request_csrf_token = request.POST.get('csrfmiddlewaretoken', '')
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/channels/handler.py",
line 119, in _get_post
    self._load_post_and_files()
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/http/request.py",
line 292, in _load_post_and_files
    if self.content_type == 'multipart/form-data':AttributeError:
'AsgiRequest' object has no attribute 'content_type'2017-04-01
23:58:42,380 - ERROR - exception - Internal Server Error:
/admin/login/Traceback (most recent call last):
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/core/handlers/exception.py",
line 39, in inner
    response = get_response(request)
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/core/handlers/base.py",
line 178, in _get_response
    response = middleware_method(request, callback, callback_args,
callback_kwargs)
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/middleware/csrf.py",
line 260, in process_view
    request_csrf_token = request.POST.get('csrfmiddlewaretoken', '')
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/channels/handler.py",
line 119, in _get_post
    self._load_post_and_files()
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/http/request.py",
line 292, in _load_post_and_files
    if self.content_type == 'multipart/form-data':AttributeError:
'AsgiRequest' object has no attribute 'content_type'Internal Server
Error: /admin/login/Traceback (most recent call last):
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/core/handlers/exception.py",
line 39, in inner
    response = get_response(request)
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/core/handlers/base.py",
line 178, in _get_response
    response = middleware_method(request, callback, callback_args,
callback_kwargs)
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/middleware/csrf.py",
line 260, in process_view
    request_csrf_token = request.POST.get('csrfmiddlewaretoken', '')
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/channels/handler.py",
line 119, in _get_post
    self._load_post_and_files()
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/http/request.py",
line 292, in _load_post_and_files
    if self.content_type == 'multipart/form-data':AttributeError:
'AsgiRequest' object has no attribute 'content_type'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/core/handlers/exception.py",
line 39, in inner
    response = get_response(request)
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/utils/deprecation.py",
line 136, in __call__
    response = self.get_response(request)
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/core/handlers/exception.py",
line 41, in inner
    response = response_for_exception(request, exc)
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/core/handlers/exception.py",
line 86, in response_for_exception
    response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/core/handlers/exception.py",
line 128, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/views/debug.py",
line 84, in technical_500_response
    html = reporter.get_traceback_html()
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/views/debug.py",
line 328, in get_traceback_html
    c = Context(self.get_traceback_data(), use_l10n=False)
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/views/debug.py",
line 304, in get_traceback_data
    'filtered_POST': self.filter.get_post_parameters(self.request),
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/views/debug.py",
line 167, in get_post_parameters
    return request.POST
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/channels/handler.py",
line 119, in _get_post
    self._load_post_and_files()
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/http/request.py",
line 292, in _load_post_and_files
    if self.content_type == 'multipart/form-data':AttributeError:
'AsgiRequest' object has no attribute 'content_type'2017-04-01
23:58:42,388 - ERROR - exception - Internal Server Error:
/admin/login/Traceback (most recent call last):
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/core/handlers/exception.py",
line 39, in inner
    response = get_response(request)
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/core/handlers/base.py",
line 178, in _get_response
    response = middleware_method(request, callback, callback_args,
callback_kwargs)
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/middleware/csrf.py",
line 260, in process_view
    request_csrf_token = request.POST.get('csrfmiddlewaretoken', '')
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/channels/handler.py",
line 119, in _get_post
    self._load_post_and_files()
  File "/home/mrc/.virtualenvs/djangotest/local/lib/python3.5/site-packages/django/http/request.py",
line 292, in _load_post_and_files
    if self.content_type == 'multipart/form-data':AttributeError:
'AsgiRequest' object has no attribute 'content_type'


Ese es el traceback que me tira como error.
Alguno me podria tirar un centro, para ver por donde sigo? no agrego mas
codigo al mail para no hacerlo tedioso, pero puedo mostrar lo que haga
falta.
Desde ya muchas gracias, saludos Marco.
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20170402/577e1d7e/attachment-0001.html>


Más información sobre la lista de distribución pyar