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

问题描述 投票:1回答:1

突然间,我不能做 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上工作,这是一个服务器。

python django ubuntu-16.04 django-staticfiles
1个回答
0
投票

我有一个类似的问题 collectstatic. 对我来说,下面的方法很有用。

python3 manage.py collectstatic --clear

根据 姜戈文档:

--clear, --c

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

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

© www.soinside.com 2019 - 2024. All rights reserved.