English 中文(简体)
将django管道升级到1.2.7,但找不到静态文件
原标题:upgrade django-pipeline to 1.2.7 but can t find static files

我过去使用django管道1.2.6,它在查找静态文件时从未遇到问题。升级后,它现在无法找到静态文件的位置。不知道怎么了,但我可能只是错过了什么。

我遇到了这个错误:

ValueError: The file  stylesheets/application.css.sass  could not be found with <pipeline.storage.PipelineFinderStorage object at 0x106e8b290>.

我使用的是django 1.4。以下是我的设置:

path = lambda *a: os.path.join(ROOT_PATH, *a)
MEDIA_ROOT =   
MEDIA_URL =   
STATIC_ROOT = path( assets/ )
STATIC_URL =  assets/ 
STATICFILES_DIRS = ()
STATICFILES_FINDERS = (
   django.contrib.staticfiles.finders.FileSystemFinder ,
   django.contrib.staticfiles.finders.AppDirectoriesFinder ,
  #  django.contrib.staticfiles.finders.DefaultStorageFinder ,
)
INSTALLED_APPS = (
  # ...
   django.contrib.staticfiles ,
   pipeline ,
   app ,
)
STATICFILES_STORAGE =  pipeline.storage.PipelineCachedStorage 
PIPELINE_COMPILERS = (
   pipeline.compilers.sass.SASSCompiler ,
   pipeline.compilers.coffee.CoffeeScriptCompiler ,
)
PIPELINE_CSS = {
     application : {
         source_filenames : (
           stylesheets/application.css.sass ,
        ),
         output_filename :  stylesheets/application.css ,
    },
}

PIPELINE_JS = {
   application : {
     source_filenames : (
       javascripts/application.js.coffee ,
    ),
     output_filename :  javascripts/application.js ,
  }
}

请帮忙。

有趣的花絮:如果我完全删除PIPELINE_CSS,它也找不到javascripts/application.js.coffee。

另一件有趣的事情是,无论我使用哪个版本的django管道,我都会得到以下结果:

$ python manage.py findstatic stylesheets/application.css.sass
No matching file found for  stylesheets/application.css.sass .

我做错了什么?

最佳回答

如果你有这个,无论你使用的是哪个版本的管道:

$ python manage.py findstatic stylesheets/application.css.sass
No matching file found for  stylesheets/application.css.sass .

这只是意味着django静态文件配置错误,一旦你弄清楚了,管道应该能正常工作。

静态文件存储在哪里?在每个应用程序的静态目录中,还是在整个项目中?

问题回答

暂无回答




相关问题
How to get two random records with Django

How do I get two distinct random records using Django? I ve seen questions about how to get one but I need to get two random records and they must differ.

Moving (very old) Zope/Plone Site to Django

I am ask to move data from a (now offline) site driven by Plone to a new Django site. These are the version informations I have: Zope Version (unreleased version, python 2.1.3 ) Python Version 2.1....

Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

Flexible pagination in Django

I d like to implement pagination such that I can allow the user to choose the number of records per page such as 10, 25, 50 etc. How should I go about this? Is there an app I can add onto my project ...

is it convenient to urlencode all next parameters? - django

While writing code, it is pretty common to request a page with an appended "next" query string argument. For instance, in the following template code next points back to the page the user is on: &...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

热门标签