don't use runserver for production ever. read the django documentation: https://docs.djangoproject.com/en/1.10/howto/deployment/
after that I suggest using nginx with uwsgi it is also worth reading uwsgi documentation, there are a lot of options you can tweak nginx also has some options you can tweak On Sat, Dec 10, 2016 at 11:38 PM, Xiao Bo <[email protected]> wrote: > Yes, I did. > > 在 2016年12月10日星期六 UTC-5下午3:37:17,Avraham Serour写道: >> >> are you using manage.py runserver? >> >> >> On Fri, Dec 9, 2016 at 10:13 PM, Xiao Bo <[email protected]> wrote: >> >>> I'm building a Django server for data collection. However, the program >>> seems not capable when the sensing network expands. As time goes on, the >>> program doesn't even enter the code piece and report broken pipe/connection >>> reset by peer/too many open files errors: >>> >>> Exception happened during processing of request from ('172.58.139.243', >>> 30713)Traceback (most recent call last): >>> File "/usr/lib/python2.7/SocketServer.py", line 593, in >>> process_request_thread >>> File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request >>> File "/usr/lib/python2.7/dist-packages/django/core/servers/basehttp.py", >>> line 126, in __init__ >>> File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__ >>> File "/usr/lib/python2.7/SocketServer.py", line 710, in finish >>> File "/usr/lib/python2.7/socket.py", line 279, in close >>> File "/usr/lib/python2.7/socket.py", line 303, in flush >>> error: [Errno 32] Broken pipe >>> [08/Dec/2016 17:46:47] "POST /Update_Data/ HTTP/1.1" 500 39484Traceback >>> (most recent call last): >>> File "/usr/lib/python2.7/wsgiref/handlers.py", line 86, in run >>> File "/usr/lib/python2.7/wsgiref/handlers.py", line 128, in >>> finish_response >>> File "/usr/lib/python2.7/wsgiref/handlers.py", line 217, in write >>> File "/usr/lib/python2.7/socket.py", line 324, in write >>> File "/usr/lib/python2.7/socket.py", line 303, in flush >>> error: [Errno 104] Connection reset by peer >>> File "/usr/lib/python2.7/random.py", line 810, in randomOSError: [Errno 24] >>> Too many open files >>> >>> I checked the open files and it seems like the socket files are never >>> closed. The list is full of items like the followings: >>> >>> python 30404 30522 ubuntu 732u IPv4 2437194784 0t0 >>> TCP 192.168.100.2:9003->172.58.137.113:18538 (ESTABLISHED) >>> python 30404 30522 ubuntu 733u IPv4 2437194788 0t0 >>> TCP 192.168.100.2:9003->172.58.137.113:55661 (ESTABLISHED) >>> python 30404 30522 ubuntu 734u IPv4 2437194792 0t0 >>> TCP 192.168.100.2:9003->172.58.137.113:42461 (ESTABLISHED) >>> python 30404 30522 ubuntu 735u IPv4 2437194793 0t0 >>> TCP 192.168.100.2:9003->172.58.137.113:40438 (ESTABLISHED) >>> python 30404 30522 ubuntu 736u IPv4 2437194797 0t0 >>> TCP 192.168.100.2:9003->172.58.137.113:52998 (ESTABLISHED) >>> >>> Any ideas? Let me know if you need any further information. >>> >>> -- >>> 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 [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at https://groups.google.com/group/django-users. >>> To view this discussion on the web visit https://groups.google.com/d/ms >>> gid/django-users/58e4d24e-ca9b-41da-8df7-3e195630b05a%40googlegroups.com >>> <https://groups.google.com/d/msgid/django-users/58e4d24e-ca9b-41da-8df7-3e195630b05a%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > 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 [email protected]. > To post to this group, send email to [email protected]. > 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/95337e92-6d5e-4f26-8e70-d2680c1d2437%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/95337e92-6d5e-4f26-8e70-d2680c1d2437%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. 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/CAFWa6t%2Bdwx8ngPGW_qc1t5ZNLosSiUBQ%2BOej%3DS%3DM5OKnZmH2aQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

