On 08/27/2010 08:58 AM, Karim Gorjux wrote:

My doubt is in these 3 variables. How I have to use they?

MEDIA_ROOT = ''
MEDIA_URL = ''
ADMIN_MEDIA_PREFIX = '/media/'

A bit of copy/paste from my settings.py:

# Absolute path to the directory that holds user-uploaded media.
MEDIA_ROOT = '/path/to/your/media/dir'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
MEDIA_URL = '/media/'

Another question. In the template how I have to refer to the files? I
have just 2: "style.css" and "header.jpg" that are located in
"/Users/karim/Projects/simplesite/template/media"

That'd have to be the value of MEDIA_ROOT, then. The MEDIA_URL is traditionally /media/, but you can really pick anything.

Is these code right?

<link rel="stylesheet" href="media/style.css" type="text/css"
media="screen" title="no title" charset="utf-8">

<img src="media/header.jpg" width="940" height="198" alt="Header">

I'd put a slash in front of "media".

Even better would be:

<img src="{{ MEDIA_URL }}header.jpg" width="940" height="198"
     alt="Header">

(Note the lack of a slash after {{ MEDIA_URL }}, btw).

For those {{ MEDIA_URL }}-like urls to work you need to use the RequestContext, see http://tinyurl.com/yllym5h



Reinout

--
Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org
Collega's gezocht!
Django/python vacature in Utrecht: http://tinyurl.com/35v34f9

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to