Opened 16 years ago

Closed 16 years ago

#7356 closed (invalid)

django templates dont know where images live?

Reported by: lindec Owned by: nobody
Component: Template system Version: 0.96
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I posted this problem on the google groups and found a hack that worked, but it's very unclean and very un-django-like. The problem, simply put, is that putting references to images, javascript or CSS in my templates just doesn't work. Django doesn't seem to know where my files live, or what the base directory is. I've tried absolute paths in my hrefs, placing CSS and JS in the same directory as templates and so on. Where exactly does Django start looking for these files? Is there some obscure setting that needs to be changed? I didn't see any information about this in the Django book. I was able to get it to work by uploading images to my other web server and using the direct URL to the image files that way, however, this is dirty and makes me have to clean up the URLs in my template when I deploy my Django app on a different server.

Change History (1)

comment:1 by Brian Rosner, 16 years ago

Resolution: invalid
Status: newclosed

Django does not serve static media by default. This can be enabled, but meant for development purposes *only*. See http://www.djangoproject.com/documentation/0.96/static_files/. Your webserver should be the only part of the stack that knows about your static media in a production environment. Please do not use the ticketing system for usage questions. That is what the django-users mailing list and #django on freenode are for.

Note: See TracTickets for help on using tickets.
Back to Top