title: No such file or directory: Python CSV
body: <p>I'm trying to create a csv file into a different directory. While running the code on development server it works fine, but on production, it raises an error that <code>No such file or directory:</code></p>
  
  <p>Following is my code:-</p>
  
  <pre><code>def write_operation(filename,data):
      with open("./static/" + filename, "wb") as f:
          writer = csv.writer(f)
          writer.writerows(data)
  
  @csrf_exempt
  def download_data(request):
  
      if request.POST.has_key('download_data'):
          start_date = str(request.POST['start_date']).replace('/','-')
          end_date = str(request.POST['end_date']).replace('/','-')
  
          start_date = datetime.datetime.strptime(start_date, "%Y-%m-%d %H:%M")
          end_date = datetime.datetime.strptime(end_date, "%Y-%m-%d %H:%M")
  
  
          data.insert(0,('Barcode','Weight', 'Length','Breadth','Height'))
          write_operation('data.csv',data)
  
          return HttpResponse(json.dumps('Success'),content_type = "application/json")
      ctx = {}
      return render(request, 'dummy/download_data.html', ctx)
  </code></pre>
  
  <p>The error that I receive is :-</p>
  
  <p><code>Exception Value: [Errno 2] No such file or directory: 'static/data.csv'</code></p>
  
  <p>Here is my directory structure:-</p>
  
  <pre><code>├── modules
  |   ├── dummy
  │   │   └── views.py
  ├── static
  </code></pre>