我正在使用 django-pipeline-browserify 来桥接 django-pipeline 和 browserify。但是,如果没有以下错误,我无法收集静态。而且我可以通过复制错误消息中显示的命令来手动编译 js 文件。因此,我不知道我在这里做错了什么。
You have requested to collect static files at the destination
location as specified in your settings:
/var/www/anime/static
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
matching file: animelist/css/style.css
Post-processed 'animelist/css/animelist_css.css' as 'animelist/css/animelist_css.css'
matching file: animelist/js/bower_components/jquery/dist/jquery.min.js
matching file: animelist/js/bower_components/react/react-with-addons.js
matching file: animelist/js/app.browserify.js
command: /usr/bin/env browserify /var/www/anime/static/animelist/js/app.browserify.js > /var/www/anime/static/animelist/js/app.browserify.browserified.js
Traceback (most recent call last):
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/compilers/__init__.py", line 120, in execute_command
stderr=subprocess.PIPE)
File "/usr/lib64/python3.4/subprocess.py", line 858, in __init__
restore_signals, start_new_session)
File "/usr/lib64/python3.4/subprocess.py", line 1456, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: ' '
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle
collected = self.collect()
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
for original_path, processed_path, processed in processor:
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/storage.py", line 33, in post_process
packager.pack_javascripts(package)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/packager.py", line 112, in pack_javascripts
return self.pack(package, self.compressor.compress_js, js_compressed, templates=package.templates, **kwargs)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/packager.py", line 105, in pack
paths = self.compile(package.paths, force=True)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/packager.py", line 99, in compile
return self.compiler.compile(paths, force=force)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/compilers/__init__.py", line 54, in compile
return list(executor.map(_compile, paths))
File "/usr/lib64/python3.4/concurrent/futures/_base.py", line 549, in result_iterator
yield future.result()
File "/usr/lib64/python3.4/concurrent/futures/_base.py", line 402, in result
return self.__get_result()
File "/usr/lib64/python3.4/concurrent/futures/_base.py", line 354, in __get_result
raise self._exception
File "/usr/lib64/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/compilers/__init__.py", line 42, in _compile
outdated=outdated, force=force)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline_browserify/compiler.py", line 28, in compile_file
return self.execute_command(command, cwd=dirname(infile))
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/compilers/__init__.py", line 135, in execute_command
raise CompilerError(e)
pipeline.exceptions.CompilerError: [Errno 2] No such file or directory: ' '
django-pipeline 设置文件
# Django Pipeline (and browserify)
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'pipeline.finders.PipelineFinder',
)
PIPELINE = {
'PIPELINE_ENABLED' : True,
'COMPILERS' : ('pipeline_browserify.compiler.BrowserifyCompiler', ),
'CSS_COMPRESSOR' : 'pipeline.compressors.NoopCompressor',
'JS_COMPRESSOR' :'pipeline.compressors.uglifyjs.UglifyJSCompressor',
'STYLESHEETS' : {
'animelist_css': {
'source_filenames': ( 'animelist/css/style.css', ),
'output_filename': 'animelist/css/animelist_css.css',
}
},
'JAVASCRIPT': {
'animelist_js': {
'source_filenames': (
'animelist/js/bower_components/jquery/dist/jquery.min.js',
'animelist/js/bower_components/react/JSXTransformer.js',
'animelist/js/bower_components/react/react-with-addons.js',
'animelist/js/app.browserify.js',
),
'output_filename': 'animelist/js/animelist.js',
}
,}
}
if DEBUG:
PIPELINE['BROWSERIFY_ARGUMENTS'] = '-t babelify'