【问题标题】:django-pipeline FileNotFoundError when i perform manage.py collectstaticdjango-pipeline FileNotFoundError 当我执行 manage.py collectstatic
【发布时间】:2018-02-19 13:23:05
【问题描述】:

这是最后几行回溯:

  File "C:\PycharmDev\TestVirtualEnv\testEnv1\lib\site-packages\pipeline\compressors\__init__.py", line 247, in execute_command
    stdin=subprocess.PIPE, stderr=subprocess.PIPE)
  File "C:\Python34\Lib\subprocess.py", line 859, in __init__
    restore_signals, start_new_session)
  File "C:\Python34\Lib\subprocess.py", line 1112, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] ...

在 settings.py 中:

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

STATIC_URL = '/static/'
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
STATIC_URL = '/static_prepared/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static_prepared'),
]
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'pipeline.finders.PipelineFinder',
)
PIPELINE = {
    'STYLESHEETS': {
        'static_prepared': {
            'source_filenames': (
              '*.css',
            ),
            'output_filename': 'colors.css'
        },
    },
    'JAVASCRIPT': {
        'static_prepared': {
            'source_filenames': (
              '*.js',
            ),
            'output_filename': 'stats.js',
        }
    }
}

我怎么了?

当我使用 manage.py collectstatic 时,它根本不适用于管道。

似乎只能像没有管道一样工作。

与没有管道相同。正常的manage.py collectstatic。

为什么会出现这个错误?

我已经在 os.path.join(BASE_DIR, ...) 上手动创建了 static 和 static_prepared 目录。

如何正确设置管道?

【问题讨论】:

    标签: django django-pipeline


    【解决方案1】:

    替换其他名称,如

    PIPELINE = {
        'STYLE': {
            'static_prepared': {
                'source_filenames': (
                  '*.css',
                ),
                'output_filename': 'colors.css'
            },
        },
        'JSCRIPT': {
            'static_prepared': {
                'source_filenames': (
                  '*.js',
                ),
                'output_filename': 'stats.js',
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2018-11-02
      • 1970-01-01
      • 2021-05-01
      • 1970-01-01
      • 2020-12-05
      • 2016-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多