Showing task progress from a Django management command
<p>I have some Django management commands that call methods in other classes to fetch data from APIs. These tasks can take a long time to complete, and I'd like to show progress in the console in a concise manner.</p>

<p>I could use <code>print()</code> to output a single line like "Fetched 22 of 3000" that writes over itself, using something like:</p>

<pre><code>print('Fetched %d of %d' % (n, total) + ' '*30, end='\r')
</code></pre>

<p>But using <code>print()</code> seems a bit nasty, and it gets output to the console when tests are run. So it seems better to use <a href="https://docs.djangoproject.com/en/1.9/topics/logging/" rel="noreferrer">logging</a>, but I can't see a way using that to display a single, constantly updated, "progress" line in the console.</p>

<p>Is there a nice way to do this?</p>