问题描述
我一直在寻找无处不在的几个小时回答我的问题,找不到任何东西,所以我决定问。
I've been looking everywhere for answer to my questions last few hours and couldn't find anything, so i decided to ask.
我遵循安装说明Dajaxice的文档,所有设置都非常相似,但不幸的是我的Dajax.core.js文件没有被解析,所以当我点击页面html源中的javascript链接,它仍然包含模板标签。我将dajaxice finder放在staticfiles_finder中(实际上我已经在ins指令中完成了所有设置。
I followed installation instruction in docs of Dajaxice, got everything setup exacly the same, but unfortunetely my Dajax.core.js file is not getting parsed, so when i click on the javascript link in page html source it still contains template tags. I included the Dajaxice finder in staticfiles_finder(actually i ve got everything setup like in the ins instruction.
我正在使用django 1.4.1开发服务器,以便测试和最新的Dajaxice版本是0.9,是否有任何差异?
I am using django 1.4.1 develop server at the moment for testing and the latest Dajaxice version which is 0.9, is that make any difference ?
settings.py中vars的顺序是否重要?
Does the order of vars in settings.py matters ?
Javascript文件没有得到解析的主要原因是什么,实际上应该被解析是什么?
What are the main reasons the Javascript files are not getting parsed, and actually when they should be parsed ?
请帮助我,因为我真的很想使用这个应用程序,但是不能让它工作。
Please help me as i really would love to use this app but just can't get it to work.
提前感谢。
推荐答案
我建议您检查 STATICFILES_FINDERS
设置和与相关的其他设置django.contrib.staticfiles
应用程序Dajaxice在此应用程序中使用一个钩子来生成 dajaxice.core
文件。
I advice you to check STATICFILES_FINDERS
settings and other settings related to django.contrib.staticfiles
app. Dajaxice uses a hook in this app to generate dajaxice.core
file.
当您使用调试服务器时静态文件生成在生产环境t上当您运行 collectstatic
命令时,将生成文件。
When you use debug server this static file is generated on the fly, on production environment the file will be generated when you run collectstatic
command.
在您的情况下,它看起来像 dajaxice.core.js
文件由另一个静态查找器创建或以其他方式提供。
In your case it looks like the dajaxice.core.js
file is founded by another static finder or served in any other way.
要检查,请运行以下操作命令
To check this please run the following command
python manage.py findstatic dajaxice/dajaxice.core.js
输出应该像
Found 'dajaxice/dajaxice.core.js' here:
/tmp/tmp9nzeEd
tmp目录将不同
还有2个陷阱与收集静态应用程序:
Also 2 pitfalls with collect static app:
- 当您更新
ajax.py
文件以包含新的dajaxice视图时,您必须再次运行collectstatic
/ li>
- 该文件在
/ tmp /
文件夹中生成。因此,如果您使用-l 键生成链接而不是复制文件,请确保您不会意外删除此文件。
- When you update your
ajax.py
file to include new dajaxice views you have to runcollectstatic
again - The file is generated in
/tmp/
folder. So if you use-l
key to generate links instead of copying files make sure that you will not remove this file by accident.
这篇关于Dajaxice javascript core文件没有被解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!