title: How to use call_command with dumpdata command to save json to file
body: <p>I am trying to use the <code>call_command</code> method to call the dumpdata <code>command</code>. Manually, I use it as follows to save the data to a file.</p>
  
  <pre><code>python manage.py dumpdata appname_one appname_two &gt; /path/to/save/file.json
  </code></pre>
  
  <p>and it saves the json file. Now, I am in a situation where I need to call this command using the <code>call_command</code> method.</p>
  
  <p>I am able to print out the json from the command using the following:</p>
  
  <pre><code>from django.core.management import call_command
  
  call_command('dumpdata', 'appname_one', 'appname_two')
  </code></pre>
  
  <p>Is there a way I can save the given data to a file like we do it from the command line?</p>