title: Work with Json files in Django (Static files)
body: <p>I want to work with <code>json</code> files in my project but it crashes.</p>
  
  <p>I read that my <code>json</code> file has to be inside the static folder. Thus I create inside this folder a new one called "data" and I put the file inside.</p>
  
  <p>Furthermore I saw that some people has to add inside the <code>settings.py</code> the following code line and I did it too.</p>
  
  <pre><code>STATICFILES_DIRS =[
      os.path.join(BASE_DIR, 'static'),
  ]
  </code></pre>
  
  <p>I don't know what can I do more, I don't know if the file is in a wrong path or if I have to do something more.</p>
  
  <p>The error is the following:</p>
  
  <blockquote>
    <p>[Errno 2] No such file or directory: 'data/arxiu.json'</p>
  </blockquote>
  
  <p>Can someone help me please?</p>
  
  <p><strong>Code (views.py):</strong></p>
  
  <pre><code>from django.shortcuts import render
  import pandas as pd
  import json
  
  def coordenadas(request):
      lat = 9.1234567
      lon = 12.1234567
      code = obtener_datos()
      ctx = {'Lat':lat,'Lon':lon, 'code':code}
  
      return render(request,'map.html', ctx)
  
  
  def obtener_datos():
      code = 0
  
      with open('data/arxiu.json') as file:
          file = json.load(file)
  
      return code
  </code></pre>
  
  <p><em>When I delete the two json lines the program works, accordingly the problem is here.</em></p>