问题
I've been looking everywhere for answer to my questions last few hours and couldn't find anything, so i decided to ask.
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.
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 ?
Does the order of vars in settings.py matters ?
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.
Thanks in advance.
回答1:
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.
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.
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
The output should look like
Found 'dajaxice/dajaxice.core.js' here:
/tmp/tmp9nzeEd
The filename in tmp dir will be different
Also 2 pitfalls with collect static app:
- 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.
来源:https://stackoverflow.com/questions/12519243/dajaxice-javascript-core-file-not-getting-parsed