Why does using a variable in settings.ALLOWED_INCLUDE_ROOTS won't let me use {% ssi %}?

Problem

I'm using Django 1.3. I will have to use many different JavaScript functions (like 10 or something) in my template.

What I first did was to put them in the <script> tag, which worked fine. But now that it works, I want to separate them from the template code. It would make the code way more read'able.

So I thought of using the {% ssi "..." parsed %} thing. Since I use Django template tags in my JavaScript code, I can't just link them from my static files with <script src="..."></script>.

Here is what works :

# This will allow the {% ssi %} tag to include files from the given paths
ALLOWED_INCLUDE_ROOTS = (
    '/THIS/IS/THE/FULL/PATH/TO/MY/PROJECT/static/js/',
)

Here is what does not work :

# Project root for further paths
PROJECT_PATH = os.path.dirname(__file__)

# This will allow the {% ssi %} tag to include files from the given paths
ALLOWED_INCLUDE_ROOTS = (
    PROJECT_PATH+'/static/js/',
)

I double-checked that the two strings were the same (with ./manage shell) and they are exactly the same (with trailing / and all).


Questions
  • Why does the second code renders me [Didn't have permission to include file] in my template ?
  • Also, how should I link the file to include in the {% ssi %} tag ? Since {% get_static_prefix %} does not work, I'm currently using the file's full path, which is ugly.

Answers


As odd as it may appear, I didn't make any change in my settings.py but it is now functionnal. I believe Mike Cooper was right and some remote code was breaking ALLOWED_INCLUDE_ROOTS path.


Need Your Help

Access database won't update from VB.NET

.net ms-access datagridview connection

Could someone please help me figure out how to get VB.NET to update its connected MS ACCESS database?

padding in one div affects other divs

html css

I have three inline-block divs like this:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.