Search code examples
django-pipeline

Django-pipeline invalid syntax


I am trying to setup django-pipeline in my test project, however, I am running into a bug which doesn't have an obvious solution. Here is the pipeline configure in the 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',
      #  }
    }
}

As you can see from the configuration, this setting will allow collectstatic to run without any problem. However, collectstatic will fail if I were to uncomment those lines. The error is shown below 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
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

Help is greatly appreciated.


Solution

  • Apparently, the error is the result of installing futures backport in pip3. Simply uninstall futures packages in your pip3.