4

sometimes on my site when I'm working on my local version, I get this error in my console :

error: [Errno 32] Broken pipe

Does anyone have an idea to where it come from and how to prevent this because it's slowing down the site a lot.

LittleBobbyTables - Au Revoir
  • 32,008
  • 25
  • 109
  • 114
flo bee
  • 830
  • 2
  • 11
  • 20
  • 3
    Are you using the dev server ? If so, your question is probably already answered at: http://stackoverflow.com/questions/7912672/django-broken-pipe-in-debug-mode – niconoe Apr 10 '13 at 20:25
  • 3
    This usually means the browser discontinued the connection while the server was still trying to generate the page. It's safe to ignore these (they only happen on the dev server). – Thane Brimhall Apr 10 '13 at 20:29

2 Answers2

4

I got this when the database connection was hanging between dev server and db (using Amazon RDS).

matthewlent
  • 549
  • 4
  • 18
2

This might be because you are using two method for inserting data into database and this cause the site to slow down.

def add_subscriber(request, email=None):
if request.method == 'POST':
    email = request.POST['email_field']
    e = Subscriber.objects.create(email=email).save()  <==== 
    return HttpResponseRedirect('/')
else:
    return HttpResponseRedirect('/')

eg. in above function error is where arrow is pointing the correct way to implement above is

def add_subscriber(request, email=None):
if request.method == 'POST':
    email = request.POST['email_field']
    e = Subscriber.objects.create(email=email)
    return HttpResponseRedirect('/')
else:
    return HttpResponseRedirect('/')
Kuldeep Rishi
  • 488
  • 5
  • 16