2016-01-16 46 views
1

我想在我的測試項目中設置django-pipeline,但是,我遇到了一個沒有明顯解決方案的錯誤。下面是在settings.py管道配置Django管道無效語法

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 

幫助是極大的讚賞。

回答

0

顯然,這個錯誤是在pip3中安裝futures backport的結果。只需卸載pip3中的期貨包即可。