当我执行 manage.py collectstatic 时,django-pipeline FileNotFoundError
django-pipeline FileNotFoundError when i perform manage.py collectstatic
最后几行回溯:
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_prepared 目录。
如何正确设置流水线?
替换其他名称,如
PIPELINE = {
'STYLE': {
'static_prepared': {
'source_filenames': (
'*.css',
),
'output_filename': 'colors.css'
},
},
'JSCRIPT': {
'static_prepared': {
'source_filenames': (
'*.js',
),
'output_filename': 'stats.js',
}
}
}
最后几行回溯:
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_prepared 目录。
如何正确设置流水线?
替换其他名称,如
PIPELINE = {
'STYLE': {
'static_prepared': {
'source_filenames': (
'*.css',
),
'output_filename': 'colors.css'
},
},
'JSCRIPT': {
'static_prepared': {
'source_filenames': (
'*.js',
),
'output_filename': 'stats.js',
}
}
}