What you want to use in your template is a reference to the media URL prior
to the static images. We're using

blah blah <img src="{{media_url}}/img/foo.jpg" alt="this is a foo"> blah
blah.. It generally requires a bunch of search & replace for the first time
you implement it, and then just remembering to reference the {{media_url}}
thereafter as you build out pages.

To make our lives easier, we made that tidbit available through our own
context_processor, of which here's a snippet:

from myproject import constants
from django.conf import settings

def common(request):
    ctx = {}
    ctx['constants'] = constants
    ctx['media_url'] = settings.MEDIA_URL
    ... more stuff here ...
    return ctx

And then in the settings.py under TEMPLATE_CONTEXT_PROCESSORS, we added:
   "myproject.context_processors.common",

There may well be a much better way to accomplish this all, but that worked
out nicely for us.

-joe

On 12/13/06, Tipan <[EMAIL PROTECTED]> wrote:
>
>
>
>
> On Dec 13, 1:58 pm, "Waylan Limberg" <[EMAIL PROTECTED]> wrote:
> > On 12/13/06, Tipan <[EMAIL PROTECTED]> wrote:
> >
> > <img src="http://192.168.1.9:3000/gobites.jpg";>
> >
> > Generally speaking I believe the conventional way to do this when both
> > servers are on one machine is to point all traffic to the static
> > server (port 80) which then proxies any non-static requests on to the
> > server running Django (on some random port). That would avoid the
> > above problem.
> > ----
> > Waylan Limberg
> > [EMAIL PROTECTED]
>
> Wayne,
> I did have some success when I changed my ref to <img
> src="/media/gobites.jpg"> and this displays images fine, but I'm not
> convinced it's not serving them in apache as well as Django.
>
> What you suggest makes sense. How would I set a proxy on the static
> port - not done that before.
>
> Tim
>
>
> >
>


--~--~---------~--~----~------------~-------~--~----~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to