On Fri, Nov 25, 2011 at 11:25 AM, Alessandro Candini <[email protected]> wrote:
> Hi everybody.
>
> I have an application with the following structure:
>
> STO
> ├── __init__.py
> ├── jsonopenlayers
> │ ├── __init__.py
> │ ├── models.py
> │ ├── static
> │ │ ├── css
> │ │ │ └── STO.css
> │ │ └── js
> │ │ └── renderMaps.js
> │ ├── tests.py
> │ └── views.py
> ├── manage.py
> ├── settings.py
> ├── templates
> │ └── jsonopenlayers
> │ └── index.html
> └── urls.py
>
> Static files are found, but I have the problem that inside renderMaps.js I
> have some Django template tag to be interpreted.
> How can I tell Django to parse also that, in addition to my index.html?
>
> Thanks in advance.
>
The only way you can manage this is to deliver that file not as a
static file, but as something that has been passed through the
template engine. The template engine can generate any content, be sure
to pass the correct content type ('text/javascript') when you return
the response, and use the cache_page decorator to avoid re-doing it
lots of times.
That is a pain, so a common work-around I use is to re-work it so that
the url to use is something that is passed to the function, and then
insert it into the appropriate templates.
Cheers
Tom
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.