Django collectstatic 可以覆盖旧文件吗?
Can Django collectstatic overwrite old files?
在我的 deb postinst 文件中:
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
When I run 'dpkg -i mypackage.deb' to install the package, no problem.
When I run 'dpkg -i mypackage.deb' to re-install the package, old
css files unchanged.
When I changed '$PYTHON manage.py collectstatic
--noinput ' to '$PYTHON manage.py collectstatic --noinput -c' and run 'dpkg -i mypackage.deb' to re-install the package, the error is
following: OSError: [Errno 2] No such file or directory:
'/opt/pkgs/myporject/static'
有什么想法吗?
Django collectstatic可以覆盖旧文件吗?
(添加到这里,也许有人会和我有同样的问题。)
是的
/opt/pkgs/mypropject/lib/python2.7/site-packages/mypropject-py2.7.egg/myapp/static/css(目录A)中css个文件的时间戳是打包完成的时间,不是安装 css 个文件的时间。
但是/opt/pkgs/myporject/static(目录B)中css个文件的时间戳是安装时间。
这就是为什么 collectstatic 有时无法覆盖我的旧 css 文件(无法将一些 css 文件从目录 A 复制到目录 B)。
在我的 deb postinst 文件中:
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
When I run 'dpkg -i mypackage.deb' to install the package, no problem.
When I run 'dpkg -i mypackage.deb' to re-install the package, old css files unchanged.
When I changed '$PYTHON manage.py collectstatic --noinput ' to '$PYTHON manage.py collectstatic --noinput -c' and run 'dpkg -i mypackage.deb' to re-install the package, the error is following: OSError: [Errno 2] No such file or directory: '/opt/pkgs/myporject/static'
有什么想法吗?
Django collectstatic可以覆盖旧文件吗?
(添加到这里,也许有人会和我有同样的问题。) 是的
/opt/pkgs/mypropject/lib/python2.7/site-packages/mypropject-py2.7.egg/myapp/static/css(目录A)中css个文件的时间戳是打包完成的时间,不是安装 css 个文件的时间。
但是/opt/pkgs/myporject/static(目录B)中css个文件的时间戳是安装时间。
这就是为什么 collectstatic 有时无法覆盖我的旧 css 文件(无法将一些 css 文件从目录 A 复制到目录 B)。