我試圖使用Django流水線-1.1.27與s3boto壓縮和過濾靜態文件,然後將它們上傳到S3桶。如果我只是使用:Django的管道和s3boto存儲似乎並不共同努力
PIPELINE_STORAGE = 'pipeline.storage.PipelineFinderStorage'
然後它工作,我得到一個靜態文件夾與我配置好的版本化文件。當我切換到
PIPELINE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
我得到
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_manager(settings)
File "/my/virtual/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/my/virtual/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 "/my/virtual/env/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/my/virtual/env/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/my/virtual/env/lib/python2.7/site-packages/pipeline/management/commands/synccompress.py", line 39, in handle
packager.pack_stylesheets(package, sync=sync, force=force)
File "/my/virtual/env/lib/python2.7/site-packages/pipeline/packager.py", line 52, in pack_stylesheets
**kwargs)
File "/my/virtual/env/lib/python2.7/site-packages/pipeline/packager.py", line 60, in pack
package['output'], package['paths'])
File "/my/virtual/env/lib/python2.7/site-packages/pipeline/versioning/__init__.py", line 45, in need_update
version = self.version(paths)
File "/my/virtual/env/lib/python2.7/site-packages/pipeline/versioning/__init__.py", line 20, in version
return getattr(self.versioner, 'version')(paths)
File "/my/virtual/env/lib/python2.7/site-packages/pipeline/versioning/hash/__init__.py", line 37, in version
buf = self.concatenate(paths)
File "/my/virtual/env/lib/python2.7/site-packages/pipeline/versioning/hash/__init__.py", line 27, in concatenate
return '\n'.join([self.read_file(path) for path in paths])
File "/my/virtual/env/lib/python2.7/site-packages/pipeline/versioning/hash/__init__.py", line 31, in read_file
file = storage.open(path, 'rb')
File "/my/virtual/env/lib/python2.7/site-packages/django/core/files/storage.py", line 33, in open
file = self._open(name, mode)
File "/my/virtual/env/lib/python2.7/site-packages/storages/backends/s3boto.py", line 177, in _open
raise IOError('File does not exist: %s' % name)
IOError: File does not exist: css/style.css
這是我源文件之一。那麼,爲什麼管道不再想做的過濾器/串連/壓縮步驟,當我切換到s3boto存儲?
這可能是因爲我在做什麼。這裏是其他配置的情況下,它可以幫助:
INSTALLED_APPS = (
...
'pipeline',
'storages',
)
STATICFILES_FINDERS = (
'pipeline.finders.PipelineFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
STATIC_ROOT = "/some/path/outside/django_project/deploy_static"
STATICFILES_DIRS =() # All statics in this site are in apps
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
PIPELINE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
PIPELINE = True
PIPELINE_AUTO = True
PIPELINE_VERSION = True
PIPELINE_VERSION_PLACEHOLDER = 'VERSION'
PIPELINE_VERSIONING = 'pipeline.versioning.hash.SHA1Versioning'
PIPELINE_CSS = {
'standard': {
'source_filenames': (
'css/style.css',
...
),
'output_filename': 'css/all-VERSION.css',
'extra_context': {
'media': 'screen,projection',
},
}
}
我的網站是在Django 1.3.1。
我跑的命令是:
python manage.py synccompress --force
的AWS creds也在設置,但這是沒有實際意義,因爲它甚至沒有得到這一點。
UPDATE加滿堆和評論
UPDATE在圖書館筆者的請求所請求的設置,我試過升級到最新的測試版。從目前觀察:
- 我不知道如何版本的壓縮文件現在
- collectstatic給我留下的壓縮文件和原件
- 仍然django-得到同樣的錯誤管道時博託存儲配置:它要送我源文件到S3,但我甚至無法看到它的上演我的資產。沒有東西放在STATIC_ROOT中。
UPDATE我已經創建了一個用於取景器的存儲空間,然後用S3Boto打破了簡單的項目。我把它推到了github上,並且包含了一個堆棧跟蹤的捕獲。
https://github.com/estebistec/simple_pipeline https://raw.github.com/estebistec/simple_pipeline/master/STACKTRACE
我會欣喜若狂,如果我能告訴我在做一些非常愚蠢的,這應該都只是工作。
什麼是你設置爲''STATIC_ROOT'',''STATICFILES_DIRS''和''PIPELINE_ROOT''?還有完整的回溯將是有用的! – cyberdelia 2012-03-07 21:05:41
添加完整堆棧,STATIC_ROOT和STATICFILES_DIRS。在1.1.27文檔中,* only *提及PIPELINE_ROOT是在絕對路徑相關的信息框中,我沒有用它來定位源文件。 – StevenC 2012-03-07 21:17:44
那麼我的空STATICFILES_DIRS會把它全部扔掉?不管文檔意味着它應該被使用,是否需要PIPELINE_ROOT? – StevenC 2012-03-07 21:20:05