This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author SG
Recipients SG, asvetlov, kristjan.jonsson, pje, r.david.murray, steve.dower, tim.golden
Date 2016-08-04.13:40:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1470318026.53.0.481146391497.issue27682@psf.upfronthosting.co.za>
In-reply-to
Content
The code is actually quite simple, I'll post it over here-

def import_eop(request):
  with open('C:/Users/sg/Desktop/projects/drfapi/venv/drf/prices_companies_indices_transpose.csv') as f:
    contents = f.readlines()
    dates = contents[0]
    dates = dates.split(",")
    dates = dates[1:]
    d = []
    for i in range(len(dates)):
      d.append(Dates(date=dates[i]))
    Dates.objects.bulk_create(d)
    companies = []
    entry = []
    for i in range(1, len(contents)):
      csline = contents[i].split(",")
      prices = csline[1:len(csline)]
      company = csline[0]
      prices =[float(x) for x in prices]
      entry = (Endday(company=company, eop=prices))
      entry.save()
  f.close()
  print('Saved to database')
  return HttpResponse('Ok')


Now as you see, I'm not even handling wsgiref.close() at all. This isn't a django issue since django community themselves pointed me to this direction. Let me know if I can be of any help.
History
Date User Action Args
2016-08-04 13:40:26SGsetrecipients: + SG, pje, kristjan.jonsson, tim.golden, r.david.murray, asvetlov, steve.dower
2016-08-04 13:40:26SGsetmessageid: <1470318026.53.0.481146391497.issue27682@psf.upfronthosting.co.za>
2016-08-04 13:40:26SGlinkissue27682 messages
2016-08-04 13:40:26SGcreate