Connection reset by peer after fetching file in django - django

i'm using django as a backend server and flutter as a mobile app.
when i request a 3d model from my django app the message
Exception occurred during processing of request from ('127.0.0.1', 49163)
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 683, in process_request_thread
self.finish_request(request, client_address)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 747, in __init__
self.handle()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/servers/basehttp.py", line 174, in handle
self.handle_one_request()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/servers/basehttp.py", line 182, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 704, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 54] Connection reset by peer
but when i open the same file from another online server it works! what should i do?

Related

testdriven.io: The Definitive Guide to Celery and Django. Running task from Django shell causes error

I am currently going through 'The Definitive Guide to Celery and Django' course by testdriven.io. I've managed to containerize the whole application. Everything was built correctly and seemed to work just fine, but when I tried to enter the Django shell and run a task, to ensure everything works correctly, the following error appeared.
>>> divide.delay(1, 2)
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/kombu/utils/functional.py", line 30, in __call__
return self.__value__
AttributeError: 'ChannelPromise' object has no attribute '__value__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 446, in _reraise_as_library_errors
yield
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 433, in _ensure_connection
return retry_over_time(
File "/usr/local/lib/python3.10/site-packages/kombu/utils/functional.py", line 312, in retry_over_time
return fun(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 877, in _connection_factory
self._connection = self._establish_connection()
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 812, in _establish_connection
conn = self.transport.establish_connection()
File "/usr/local/lib/python3.10/site-packages/kombu/transport/pyamqp.py", line 201, in establish_connection
conn.connect()
File "/usr/local/lib/python3.10/site-packages/amqp/connection.py", line 323, in connect
self.transport.connect()
File "/usr/local/lib/python3.10/site-packages/amqp/transport.py", line 129, in connect
self._connect(self.host, self.port, self.connect_timeout)
File "/usr/local/lib/python3.10/site-packages/amqp/transport.py", line 184, in _connect
self.sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python3.10/site-packages/celery/app/task.py", line 425, in delay
return self.apply_async(args, kwargs)
File "/usr/local/lib/python3.10/site-packages/celery/app/task.py", line 575, in apply_async
return app.send_task(
File "/usr/local/lib/python3.10/site-packages/celery/app/base.py", line 788, in send_task
amqp.send_task_message(P, name, message, **options)
File "/usr/local/lib/python3.10/site-packages/celery/app/amqp.py", line 510, in send_task_message
ret = producer.publish(
File "/usr/local/lib/python3.10/site-packages/kombu/messaging.py", line 177, in publish
return _publish(
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 523, in _ensured
return fun(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/kombu/messaging.py", line 186, in _publish
channel = self.channel
File "/usr/local/lib/python3.10/site-packages/kombu/messaging.py", line 209, in _get_channel
channel = self._channel = channel()
File "/usr/local/lib/python3.10/site-packages/kombu/utils/functional.py", line 32, in __call__
value = self.__value__ = self.__contract__()
File "/usr/local/lib/python3.10/site-packages/kombu/messaging.py", line 225, in <lambda>
channel = ChannelPromise(lambda: connection.default_channel)
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 895, in default_channel
self._ensure_connection(**conn_opts)
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 432, in _ensure_connection
with ctx():
File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 450, in _reraise_as_library_errors
raise ConnectionError(str(exc)) from exc
kombu.exceptions.OperationalError: [Errno 111] Connection refused
I've done a quick research and in most cases it seemed to be a lack of the following lines
from config.celery import app as celery_app
__all__ = ['celery_app']
in the config.__init__.py, but it's clearly not an issue here.
I also double checked whether redis container is up and listening on port 6379.
The only difference between my code and the course code is that I decided to use Poetry package manager instead of requirements.txt file and pip.
At this point I am a little bit confused I'll be thankful for any tip. You can find the whole code below:
https://github.com/Kibraks/django-celery-app

brownie.exceptions.RPCRequestError: Web3 is not connected

I am trying to deploy a helloWorld.sol using brownie. I am getting below error when I tried to run brownie run scripts/deploy.py.
Terminating local RPC client... Exception in thread Thread-5:
Traceback (most recent call last): File
"C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connection.py",
line 175, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\util\connection.py",
line 96, in create_connection
raise err File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\util\connection.py",
line 86, in create_connection
sock.connect(sa) ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused
it
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connectionpool.py",
line 706, in urlopen
chunked=chunked, File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connectionpool.py",
line 394, in _make_request
conn.request(method, url, **httplib_request_kw) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connection.py",
line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "C:\Program
Files\Python37\lib\http\client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked) File "C:\Program Files\Python37\lib\http\client.py", line 1275, in
_send_request
self.endheaders(body, encode_chunked=encode_chunked) File "C:\Program Files\Python37\lib\http\client.py", line 1224, in
endheaders
self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Program Files\Python37\lib\http\client.py", line 1016, in
_send_output
self.send(msg) File "C:\Program Files\Python37\lib\http\client.py", line 956, in send
self.connect() File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connection.py",
line 205, in connect
conn = self._new_conn() File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connection.py",
line 187, in _new_conn
self, "Failed to establish a new connection: %s" % e urllib3.exceptions.NewConnectionError:
<urllib3.connection.HTTPConnection object at 0x0000021DAA2A0F28>:
Failed to establish a new connection: [WinError 10061] No connection
could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\adapters.py",
line 449, in send
timeout=timeout File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connectionpool.py",
line 756, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File
"C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\util\retry.py",
line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1',
port=8545): Max retries exceeded with url: / (Caused by
NewConnectionError('<urllib3.connection.HTTPConnection object at
0x0000021DAA2A0F28>: Failed to establish a new connection: [WinError
10061] No connection could be made because the target machine actively
refused it'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\ganache.py",
line 82, in _request
response = web3.provider.make_request(method, args) # type: ignore File
"C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\web3\providers\rpc.py",
line 91, in make_request
**self.get_request_kwargs() File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\web3_utils\request.py",
line 48, in make_post_request
response = session.post(endpoint_uri, data=data, *args, **kwargs) # type: ignore File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\sessions.py",
line 590, in post
return self.request('POST', url, data=data, json=json, **kwargs) File
"C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\sessions.py",
line 542, in request
resp = self.send(prep, **send_kwargs) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\sessions.py",
line 655, in send
r = adapter.send(request, **kwargs) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\adapters.py",
line 516, in send
raise ConnectionError(e, request=request) requests.exceptions.ConnectionError:
HTTPConnectionPool(host='127.0.0.1', port=8545): Max retries exceeded
with url: / (Caused by
NewConnectionError('<urllib3.connection.HTTPConnection object at
0x0000021DAA2A0F28>: Failed to establish a new connection: [WinError
10061] No connection could be made because the target machine
actively refused it'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Program
Files\Python37\lib\threading.py", line 917, in _bootstrap_inner
self.run() File "C:\Program Files\Python37\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\state.py",
line 332, in add_to_undo_buffer
self.sleep(0) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\state.py",
line 375, in sleep
self.time_offset = int(rpc.Rpc().sleep(seconds)) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc_init.py",
line 45, in wrapped
return fn(*args, **kwargs) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc_init.py",
line 166, in sleep
return self.backend.sleep(seconds) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\ganache.py",
line 91, in sleep
return _request("evm_increaseTime", [seconds]) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\ganache.py",
line 86, in _request
raise RPCRequestError("Web3 is not connected.") brownie.exceptions.RPCRequestError: Web3 is not connected.
My deploy.py code is below.
from brownie import accounts, HelloWorld
def deployHelloWorld():
account = accounts[0]
helloWorldObject = HelloWorld.deploy({"from": account})
helloWorldObject.setName("Michael", {"from": account})
greeting = helloWorldObject.sayHello()
print(greeting)
def main():
deployHelloWorld()
could you please help?
This error is caused because there is no waiting after transaction. By using transaction.wait(1), as below, the problem is fixed.
transaction = helloWorldObject.setName("Michael", {"from": account})
transaction.wait(1)
greeting = helloWorldObject.sayHello()
print(greeting)
RPC is sometimes killed too quick, resulting in brownie.exceptions.RPCRequestError: Web3 is not connected.
Therefore you have to add the time.sleep(1) after every transaction to ensure your code runs smoothly.
You need to put after transactions
transactionVariable.wait(1)
time.sleep(1)

Django video streaming

greetings!
I'm trying to implement a video streaming application in django. the consumer of the video will be a mobile application which would stream and display the video.
My requirement is to ensure that I stream the video (like in youtube), rather than downloading the video file and playing it on the device.
I did go through the various resources available. I have the following implemented currently.
urls.py
from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from .views import video_stream
urlpatterns = [
path('admin/', admin.site.urls),
path(r'videos/', video_stream, name='v_stream'),
#url(r'^media/', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
views.py
import os, mimetypes
from django.http import HttpResponseNotFound
from ranged_response import RangedFileResponse
from django.core.files.storage import default_storage
from django.http import HttpResponse
from django.core.files.storage import FileSystemStorage
from django.conf import settings
import urllib, mimetypes
from django.http import HttpResponse, Http404, StreamingHttpResponse, FileResponse
import os
from django.conf import settings
from wsgiref.util import FileWrapper
import requests
def video_stream(request):
r = requests.get('http://127.0.0.1:8000/media/watermark.mp4', stream=True)
response = StreamingHttpResponse(streaming_content=r)
return response
when I run the application, I do not get the video playing, however, I get the following:
I tried using the vlc media player's stream from url function. I got the following error.
System check identified no issues (0 silenced).
August 08, 2020 - 17:59:44
Django version 3.0.5, using settings 'streamer.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[08/Aug/2020 18:00:29] "GET /media/watermark.mp4 HTTP/1.1" 200 40143859
[08/Aug/2020 18:00:30] "GET /videos/ HTTP/1.1" 200 40143859
[08/Aug/2020 18:00:30] "GET /videos/ HTTP/1.1" 200 324736
[08/Aug/2020 18:00:30] "GET /media/watermark.mp4 HTTP/1.1" 200 3604480
Traceback (most recent call last):
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 279, in write
self._write(data)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 775, in write
self._sock.sendall(b)
Traceback (most recent call last):
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 279, in write
self._write(data)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 775, in write
self._sock.sendall(b)
[08/Aug/2020 18:00:31] "GET /videos/ HTTP/1.1" 500 59
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 63778)
[08/Aug/2020 18:00:31] "GET /media/watermark.mp4 HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 63779)
Traceback (most recent call last):
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
Traceback (most recent call last):
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 279, in write
self._write(data)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 775, in write
self._sock.sendall(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\servers\basehttp.py", line 119, in handle_error
super().handle_error()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 279, in write
self._write(data)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 775, in write
self._sock.sendall(b)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 344, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\servers\basehttp.py", line 119, in handle_error
super().handle_error()
Traceback (most recent call last):
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 639, in process_request_thread
self.finish_request(request, client_address)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 344, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 696, in __init__
self.handle()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\servers\basehttp.py", line 172, in handle
self.handle_one_request()
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\servers\basehttp.py", line 197, in handle_one_request
handler.run(self.server.get_app())
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 144, in run
self.close()
Traceback (most recent call last):
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\servers\basehttp.py", line 114, in close
super().close()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 639, in process_request_thread
self.finish_request(request, client_address)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 696, in __init__
self.handle()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\servers\basehttp.py", line 172, in handle
self.handle_one_request()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\servers\basehttp.py", line 197, in handle_one_request
handler.run(self.server.get_app())
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\handlers.py", line 144, in run
self.close()
----------------------------------------
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\servers\basehttp.py", line 114, in close
super().close()
File "C:\Users\win10\AppData\Local\Programs\Python\Python36-32\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
I basically want to serve media files from my django application. and from a mobile application consume and stream the video file in an application.
I am using Xamarin forms for mobile application development.
Any help/guidance is deeply appreciated.

what should be the best way to move my django rest app to https

I am using https://github.com/teddziuba/django-sslserver as an https server for my django-rest app. it works fine if I test it on admin or in chrome's api client(when admin runs on chrome as well). But whenever I try to test it from firefox, I get the following exception:
Exception happened during processing of request from ('127.0.0.1', 51984)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/home/diwakar/virtualenvs/everybillapienv/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 102, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
self.handle()
File "/home/diwakar/virtualenvs/everybillapienv/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 167, in handle
self.raw_requestline = self.rfile.readline(65537)
File "/usr/lib/python2.7/socket.py", line 476, in readline
data = self._sock.recv(self._rbufsize)
File "/usr/lib/python2.7/ssl.py", line 341, in recv
return self.read(buflen)
File "/usr/lib/python2.7/ssl.py", line 260, in read
return self._sslobj.read(len)
SSLError: [Errno 1] _ssl.c:1429: error:14094418:SSL routines:SSL3_READ_BYTES:tlsv1 alert unknown ca
Should I use that csrf_exempt decorator to get rid of this exception ? my app only have a mobile client, it would never have an browser/javascript client for sure.
How strong is django-sslserver ? Can I use it on production ?
What should be the easiest way to redirect http traffic to https here, I've heard a combination of easy-userena and django-privatebeta does it. Any suggestions ?

Django shows an error after close IE10

I'm getting this error below after set SESSION_EXPIRE_AT_BROWSER_CLOSE = True on my settings.py. I can open and login and logout with no errors...but if I close before login I get this error. Is there a way to fix it?
Thanks in advance!
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 63792)
Traceback (most recent call last):
File "c:\Python27\lib\SocketServer.py", line 582, in process_request_thread
self.finish_request(request, client_address)
File "c:\Python27\lib\SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 150
, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "c:\Python27\lib\SocketServer.py", line 638, in __init__
self.handle()
File "c:\Python27\lib\wsgiref\simple_server.py", line 116, in handle
self.raw_requestline = self.rfile.readline()
File "c:\Python27\lib\socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 10054] An existing connection was cancelled by the remote host
----------------------------------------