什么应该是我的django休息应用程序移动到https的最佳方式

时间:2015-06-30 21:32:19

标签: django ssl ssl-certificate django-rest-framework

我正在使用https://github.com/teddziuba/django-sslserver作为我的django-rest应用的https服务器。如果我在管理员或chrome的api客户端上测试它(当管理员也在chrome上运行时),它可以正常工作。但每当我尝试从firefox测试它时,我得到以下异常:

    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
  1. 我应该使用那个csrf_exempt装饰器来摆脱这个异常吗?我的应用只有一个移动客户端,它肯定永远不会有浏览器/ javascript客户端。
  2. django-sslserver有多强?我可以在生产中使用它吗?
  3. 这里将http流量重定向到https的最简单方法是什么,我听说过easy-userena和django-privatebeta的组合。有什么建议吗?

0 个答案:

没有答案