Django管道生成空文件 [英] Django pipeline generates empty files

查看:49
本文介绍了Django管道生成空文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的django项目中有多个应用程序,并且正在使用管道压缩文件,并且一切正常,但是我有一个名为" mypage "的应用程序,为此,每个文件在调用后都会生成 collectstatic 为空!(如果我将文件从 mypage/static 复制到另一个应用程序的静态文件夹中,则会正确生成该文件!)我要疯了!如何调试此行为?(由于正确生成了其他静态文件,因此控制台中未显示任何错误或警告,并且正确定义了管道配置)也许"mypage"是某种保留字?0_o

I've got several apps in my django project and I'm using pipeline to compress files and all works fine, but I have an app called "mypage" for which every file generated after calling collectstatic is empty! (if I copy a file from mypage/static into another app static folder it's properly generated!) I'm going crazy! How can I debug this behavior? (no error or warning is displayed in the console and the pipeline configuration is properly defined because other static files are properly generated) Is perhaps "mypage" a somehow reserved word? 0_o

这是我的配置:

STATIC_URL = '/static/'
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'pipeline.finders.PipelineFinder',
    'pipeline.finders.CachedFileFinder',
)
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
PIPELINE_DISABLE_WRAPPER = True
PIPELINE_ENABLED = True
PIPELINE_JS = {
    'foo': {
        'source_filenames': (
            'mypage/js/controllers/MyController.js',
        ),
        'output_filename': 'mypage/js/foo.js'
    },
}

...生成的"foo.js"是一个空文件,如果我将"MyController.js"移至另一个应用程序,比如说"fooapp",那么fooapp/js/foo.js将包含预期的JavaScript:(

...the generated "foo.js" is an empty file, if I move "MyController.js" to another app, let's say "fooapp", then fooapp/js/foo.js will contains the expected JavaScript :(

推荐答案

检查文件路径为 mypage/static/mypage/js/controllers/MyController.js .

这篇关于Django管道生成空文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆