Django:collectstatic引发OSError:[Errno 39]目录不为空:(ckeditor)

时间:2018-07-24 10:28:29

标签: python django ubuntu-16.04 django-staticfiles

突然,我无法做collectstatic

python manage.py collectstatic

Type 'yes' to continue, or 'no' to cancel: yes
Found another file with the destination path 'admin/js/jquery.init.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/django/maklerienv36/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/home/django/maklerienv36/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/django/maklerienv36/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/django/maklerienv36/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "/home/django/maklerienv36/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 189, in handle
    collected = self.collect()
  File "/home/django/maklerienv36/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
    handler(path, prefixed_path, storage)
  File "/home/django/maklerienv36/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 344, in copy_file
    if not self.delete_file(path, prefixed_path, source_storage):
  File "/home/django/maklerienv36/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 294, in delete_file
    self.storage.delete(prefixed_path)
  File "/home/django/maklerienv36/lib/python3.6/site-packages/django/core/files/storage.py", line 299, in delete
    os.rmdir(name)
OSError: [Errno 39] Directory not empty: '/home/django/makleri/static/ckeditor'

我试图删除整个静态文件夹并重新运行collectstatic,但没有帮助。你知道如何使它工作吗?

它可以在我的PC上运行,这是一台服务器。

1 个答案:

答案 0 :(得分:0)

我对collectstatic有类似的问题。对我来说,以下帮助:

python3 manage.py collectstatic --clear

根据django docs

-清除,-c

在尝试复制或链接原始文件之前,请清除现有文件。

问题是self.delete_file(path, prefixed_path, source_storage)在非空目录上不起作用。 -rf会有所帮助,但django的collectstatic.py不会使用它。