2

我正在尝试部署一个 django 站点,但无法manage.py collectstatic完成命令。它收集了大部分文件,但从未完成......返回以下回溯。我正在使用 django1.3 和 python2.7。

此外,DEBUG = False并且'django.contrib.staticfiles'在我安装的应用程序中。

追溯:

Traceback (most recent call last):
  File "manage.py", line 14, in <module>
    execute_manager(settings)
  File "/home/rowapparel/.virtualenvs/dev_ra_env/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/home/rowapparel/.virtualenvs/dev_ra_env/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/rowapparel/.virtualenvs/dev_ra_env/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/rowapparel/.virtualenvs/dev_ra_env/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/home/rowapparel/.virtualenvs/dev_ra_env/lib/python2.7/site-packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/home/rowapparel/.virtualenvs/dev_ra_env/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 80, in handle_noargs
    for path, storage in finder.list(ignore_patterns):
  File "/home/rowapparel/.virtualenvs/dev_ra_env/lib/python2.7/site-packages/django/contrib/staticfiles/finders.py", line 210, in list
    for path in utils.get_files(self.storage, ignore_patterns):
  File "/home/rowapparel/.virtualenvs/dev_ra_env/lib/python2.7/site-packages/django/contrib/staticfiles/utils.py", line 21, in get_files
    directories, files = storage.listdir(location)
    File "/home/rowapparel/.virtualenvs/dev_ra_env/lib/python2.7/site-    packages/django/core/files/storage.py", line 109, in listdir
    raise NotImplementedError()
NotImplementedError

同样,它适用于我的很多静态文件,但不是全部。它似乎每次都停在同一个文件上,但是当我忽略该应用程序和/或文件时,它仍然返回上述回溯。

有任何想法吗?

4

1 回答 1

3

根据 django-storages文档,将 collectstatic 文件放入 s3 存储桶的正确方法是在设置中定义以下内容:

STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'

...您不能使用storeages.backends.s3.s3Storage,因为该后端没有定义 listdir 方法... boto 后端可以。

于 2012-08-13T22:08:43.403 回答