我一直在尝试让django管道能够组合和缩小我的css和js资产。我似乎无法解决以下问题。当我跑步时:
python manage.py collectstatic --noinput我收到一个错误:
pipeline.exceptions.CompressorError: The system cannot find the path specified.我可能需要安装一些额外的软件包吗?如果是这样的话,是怎么做的?
django的我的设置-管道:
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'pipeline.finders.PipelineFinder',
)
PIPELINE_CSS = {
'testme': {
'source_filenames': {
'static/surveys/css/main.css',
},
'output_filename': 'css/testme.css',
},
}
PIPELINE_JS = {
'testmejs': {
'source_filenames': {
'surveys/js/gklib.js',
},
'output_filename': 'surveys/js/testmejs.css',
},
}
PIPELINE_ENABLED = True这是完整的输出:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line
utility.execute()
File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\core\management\__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\core\management\base.py", line 338, in execute
output = self.handle(*args, **options)
File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\core\management\base.py", line 533, in handle
return self.handle_noargs(**options)
File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py", line 168, in handle_noargs
collected = self.collect()
File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py", line 114, in collect
for original_path, processed_path, processed in processor:
File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\storage.py", line 36, in post_process
packager.pack_javascripts(package)
File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\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 "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\packager.py", line 106, in pack
content = compress(paths, **kwargs)
File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\compressors\__init__.py", line 67, in compress_js
js = getattr(compressor(verbose=self.verbose), 'compress_js')(js)
File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\compressors\yuglify.py", line 13, in compress_js
return self.compress_common(js, 'js', settings.PIPELINE_YUGLIFY_JS_ARGUMENTS)
File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\compressors\yuglify.py", line 10, in compress_common
return self.execute_command(command, content)
File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\compressors\__init__.py", line 240, in execute_command
raise CompressorError(stderr)
pipeline.exceptions.CompressorError: The system cannot find the path specified.更新
我用另一个压缩机又试了一次:
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.csstidy.CSSTidyCompressor'这给出了完全相同的结果,我做错了什么?
更新2
如果我将压缩器设置为“无”,那么所有的文件都能工作,即文件被组合并放置在静态文件文件夹中。他们也得到了正确的服务。
PIPELINE_CSS_COMPRESSOR = None
PIPELINE_JS_COMPRESSOR = None因此,它必须是在访问或使用压缩机的东西。我在Windows上运行。
更新3
我添加了一些print()命令到init.py in /site-packages/管道/压缩器/
class SubProcessCompressor(CompressorBase):
def execute_command(self, command, content):
import subprocess
print("Command: " + command)命令是: /usr/bin/env/ yuglify -type=css-哪个终端可以(可能?)永远不要在Windows上工作。
然后,我尝试将它部署到AWS ElasticBean秸秆,但是我也得到了一个错误:
INFO: Environment update is starting.
INFO: Deploying new version to instance(s).
ERROR: [Instance: i-75dc5e91 Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: [CMD-AppDeploy/AppDeployStage0/EbExtensionPostBuild] command failed with error code 1: Error occurred during build: Command 01_collectstatic failed.
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
INFO: New application version was deployed to running EC2 instances.
ERROR: Update environment operation is complete, but with errors. For more information, see troubleshooting documentation.
ERROR: Update environment operation is complete, but with errors. For more information, see troubleshooting documentation.我知道手动设置压缩机仓的位置是可能的,但是在哪里可以设置弹性豆杆呢?
有什么建议可以解决吗?
发布于 2015-03-03 18:30:50
我已经通过向.eb扩展名/app.config文件中添加命令来修复它:
# these commands run before the application and web server are
# set up and the application version file is extracted
commands:
01_node_install:
# run this command from /tmp directory
cwd: /tmp
# don't run the command if node is already installed (file /usr/bin/node exists)
test: '[ ! -f /usr/bin/node ] && echo "node not installed"'
# install from epel repository
# flag -y for no-interaction installation
command: 'yum install -y nodejs npm --enablerepo=epel'
command: 'npm -g install yuglify'这些命令是基于我在http://qpleple.com/install-nodejs-on-elastic-beanstalk/上发现的
https://stackoverflow.com/questions/28820407
复制相似问题