ValueError: Empty key names are not allowed when using collectstatic django
ValueError: Empty key names are not allowed when using collectstatic django
我正在使用 django-pipeline
S3PipelineManifestStorage
和 django-storages
当我使用 collectstatic 上传和 post-process(minify) 我的资产时,
post-processing.
时出现错误
早些时候,collectstatic 工作正常,没有报错。
这是完整的回溯
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle
collected = self.collect()
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
for original_path, processed_path, processed in processor:
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/storage.py", line 26, in post_process
packager.pack_stylesheets(package)
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/packager.py", line 96, in pack_stylesheets
variant=package.variant, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/packager.py", line 105, in pack
paths = self.compile(package.paths, force=True)
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/packager.py", line 34, in paths
return [path for path in self.sources
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/packager.py", line 26, in sources
for path in glob(pattern):
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/glob.py", line 18, in glob
return sorted(list(iglob(pathname)))
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/glob.py", line 29, in iglob
if staticfiles_storage.exists(pathname):
File "/app/.heroku/python/lib/python2.7/site-packages/storages/backends/s3boto.py", line 445, in exists
k = self.bucket.new_key(self._encode_name(name))
File "/app/.heroku/python/lib/python2.7/site-packages/boto/s3/bucket.py", line 623, in new_key
raise ValueError('Empty key names are not allowed')
ValueError: Empty key names are not allowed
能否请您弄清楚为什么会出现此错误?
管道设置有问题
PIPELINE_CSS ={
'maths_landing_page':{
'source_filenames':(
'html/css/maths-landing-page.css'
),
'output_filename':'html/css/maths-landing-page-consolidated.css',
}
}
虽然实际设置是
PIPELINE_CSS ={
'maths_landing_page':{
'source_filenames':(
'html/css/maths-landing-page.css',
),
'output_filename':'html/css/maths-landing-page-consolidated.css',
}
}
注意元组中的逗号。
显然。
>>> type( ('a') )
<type 'str'>
>>> type( ('a',) )
<type 'tuple'>
我正在使用 django-pipeline
S3PipelineManifestStorage
和 django-storages
当我使用 collectstatic 上传和 post-process(minify) 我的资产时, post-processing.
时出现错误早些时候,collectstatic 工作正常,没有报错。
这是完整的回溯
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle
collected = self.collect()
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
for original_path, processed_path, processed in processor:
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/storage.py", line 26, in post_process
packager.pack_stylesheets(package)
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/packager.py", line 96, in pack_stylesheets
variant=package.variant, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/packager.py", line 105, in pack
paths = self.compile(package.paths, force=True)
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/packager.py", line 34, in paths
return [path for path in self.sources
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/packager.py", line 26, in sources
for path in glob(pattern):
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/glob.py", line 18, in glob
return sorted(list(iglob(pathname)))
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/glob.py", line 29, in iglob
if staticfiles_storage.exists(pathname):
File "/app/.heroku/python/lib/python2.7/site-packages/storages/backends/s3boto.py", line 445, in exists
k = self.bucket.new_key(self._encode_name(name))
File "/app/.heroku/python/lib/python2.7/site-packages/boto/s3/bucket.py", line 623, in new_key
raise ValueError('Empty key names are not allowed')
ValueError: Empty key names are not allowed
能否请您弄清楚为什么会出现此错误?
管道设置有问题
PIPELINE_CSS ={
'maths_landing_page':{
'source_filenames':(
'html/css/maths-landing-page.css'
),
'output_filename':'html/css/maths-landing-page-consolidated.css',
}
}
虽然实际设置是
PIPELINE_CSS ={
'maths_landing_page':{
'source_filenames':(
'html/css/maths-landing-page.css',
),
'output_filename':'html/css/maths-landing-page-consolidated.css',
}
}
注意元组中的逗号。
显然。
>>> type( ('a') )
<type 'str'>
>>> type( ('a',) )
<type 'tuple'>