Can Django collectstatic overwrite old files?
<p>In my deb postinst file:</p>

<pre><code>PYTHON=/usr/bin/python
PYTHON_VERSION=`$PYTHON -c 'import sys; print sys.version[:3]'`
SITE_PACKAGES=/opt/pkgs/mypackage/lib/python$PYTHON_VERSION/site-packages
export PYTHONPATH=$SITE_PACKAGES
echo "collect static files"
$PYTHON manage.py collectstatic --noinput 
</code></pre>

<blockquote>
  <p>When I run 'dpkg -i mypackage.deb' to install the package, no problem.</p>
  
  <p>When I run 'dpkg -i mypackage.deb' to <strong>re-install the package, old
  css files unchanged</strong>. </p>
  
  <p>When I changed '$PYTHON manage.py collectstatic
  --noinput ' to '$PYTHON manage.py collectstatic --noinput -c' and run 'dpkg -i mypackage.deb' to <strong>re-install the package</strong>, the error is
  following: OSError: [Errno 2] No such file or directory:
  '/opt/pkgs/myporject/static'</p>
</blockquote>

<p>Any idea?</p>

<p><strong>Can Django collectstatic overwrite old files?</strong></p>

<p>(Added here, maybe someone will have same problems with mine.)
Yes.</p>

<p>The timestamp of css files in /opt/pkgs/mypropject/lib/python2.7/site-packages/mypropject-py2.7.egg/myapp/static/css (directory A) is the time when package building finished, not the time when css files installed.</p>

<p>But the timestamp of css files in /opt/pkgs/myporject/static (directory B) is the time of installation.</p>

<p>That is why collectstatic sometimes cannot overwrite my old css files (cannot copy some css files from directory A to directory B).</p>

python css django debian deb