Re: dilemma with urls and templates
Hi,
Imho there's a MEDIA_URL field in settings,
so you could use that, and uset {% MEDIA_URL %} in your template (you
could also add template context processors)
-djibon-
On 10/13/09, rvandam <het.oosten@gmail.com> wrote:
>
> I am working on a site with a static part (i use the Djano tempate
> system to separate menu's and header from the content), and a dynamic
> part. For the static part i have a directory structure like:
>
> index.html
> page1.html
> page2.html
>
> request for / will load index.html
>
> A part of my urls.py:
> (r'^$', 'django.views.generic.simple.direct_to_template',
> {'template': 'index.html'}),
> (r'^index.html$',
> 'django.views.generic.simple.direct_to_template', {'template':
> 'index.html'}),
>
> The "trouble" starts when i want to add forms to the site. Forms only
> work from a subdirectory like /forms/ When i use the same parent
> template as above the media link is not right anymore. Is /media/css/
> style.css, should be ../media/css/style.css
>
> How should i handle this? I could hardlink the media files in the
> template (like http://mydomain.com/media/css/style.css) but then i
> have to edit every template. This will also be a big pain when i
> switch the domain.
>
> I could also have multiple parent templates, but this solution is not
> satisfactory for me either.
>
> Changing the urls from index.html into /index/ could also work, but
> then i have a problem with requests for / (i could redirect these to /
> index/ but i don't know if i am happy with that).
>
> What is the right approach for this?
> >
>
--
--------------------------------------------------------------
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--------------------------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home