Thanks!! I had the same problem adding external CSS and Javascript
files as well. This seems like an absurd problem to have, given that
its obvious that developers would want to add CSS/JS files to their
templates. I wonder why the developers have not addressed this?
On Jun 1, 4:14 am, Jarred Bishop <[EMAIL PROTECTED]> wrote:
> Hi, the problem is (like you mentioned) django has no reference to
> where your images are.
>
> A way i got around this was, adding a line to my urls.py that
> contained a 'static' folder. for example:
>
> (r'^static/(?P<path>.*)$', 'django.views.static.serve',
> {'document_root': 'C:/path-to-project/templates/static/',
> 'show_indexes' : True}),
>
> Now, any urls that start with /static/ get pointed to a folder on my
> computer. so whenever i want an image, i place it in 'C:/project/
> templates/static/images' and i can reference it from django from the
> following urlhttp://127.0.0.1:8000/static/images/image.jpg
>
> the good thing is, this also works for css, javascript, html, & xml
> files.
>
> obviously if you move your project online that folder structure will
> have to be changed to reflect your server.
>
> hopefully that helps. I'm relatively new with django also so there
> could be another/better way to do this.
>
> Jarred
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---