1

我正在尝试在我的测试项目中设置 django-pipeline,但是,我遇到了一个没有明显解决方案的错误。这是 settings.py 中的管道配置

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.js',
      #  }
    }
}

从配置中可以看出,此设置将允许 collectstatic 毫无问题地运行。但是,如果我取消注释这些行,collectstatic 将失败。错误如下所示您已请求在设置中指定的目标位置收集静态文件:

    /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
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 49, in compile
from concurrent import futures
  File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
  File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/concurrent/futures/_base.py", line 355
    raise type(self._exception), self._exception, self._traceback
                           ^
SyntaxError: invalid syntax

非常感谢您的帮助。

4

1 回答 1

0

显然,错误是在 pip3 中安装 futures backport 的结果。只需卸载 pip3 中的期货包。

于 2016-01-20T10:24:01.080 回答