title: Django + Apache - file.open() Permission Denied
body: <p>So I have the following problem:
  On an ivent a javascript sends some text to the django server and there are two functions that should work:
  views.py:</p>
  
  <pre><code>def log(request):
    f = open('media/log.txt', 'r')
    return HttpResponse(f, mimetype='text/plain')
  
  def modelers(request):
      mod_stat = request.POST['id']
      time = datetime.datetime.now().strftime("%b %d %Y %H:%M:%S")
      file=open('media/log.txt', 'a')
      file.write(time)
      file.write(' ')
      file.write(mod_stat)
      file.write('\n')
      file.close()
  
  return ErrorResponse()
  </code></pre>
  
  <p>so the user clicks on a button and the "modelers" function is getting the info and is trying to add a line to the log file. But it doesn't work! 
  The apache error.log says that </p>
  
  <p>IOError: [Errno 13] Permission denied: 'media/log.txt', referer: ...</p>
  
  <p>chmod 777 media doesn't help.. I know that I must config the apache somehow to let the django write files, but didn't find how :(</p>
  
  <p>If not under apache it works great(so the url.py is OK), but I need to make it work with apache. The other part of the application also works fine but there are no operations with files.. until now..</p>