views:

32

answers:

2

Hello. I've got a new project, and currently I'm trying to set it correctly. But somehow I can't make my media files work. Here's my current setting :

MEDIA_ROOT = os.path.normpath( '/home/budzyk/rails/fandrive/site_media/' )

templates setting work on the other hand :

TEMPLATE_DIRS = (
        "/home/budzyk/rails/fandrive/templates",
)

Catalog with media files is ../fandrive/site-media/ so why it's not working ? Here's my base.html template with styles imported, and firebug window when my page is loaded :

<head>
    <title>{% block title %}{% endblock %}</title>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/style.css" />
    {% block pagecss %}{% endblock %}
    <script type="text/javascript" src="{{ MEDIA_URL }}jquery/jquery-1.4.2.min.js"></script>
</head>
<body>
    <div id="wrapper">

http://img237.imageshack.us/img237/4909/21205809.jpg

+2  A: 

You are going to have to set this up on the web server or use the methods in the link below.

http://docs.djangoproject.com/en/dev/howto/static-files/

tdedecko
damn, right. Forgot about that ! But still why my styles and jquery are imported to body not head ? Now styles are loaded but still sit inside body tags
sasquatch90
That is strange. My guess is either you are doing something *really* weird with extends and include tags or that whatever you are using to render the html is choosing to rearrange it for some unknown reason...
tdedecko
A: 

Setting MEDIA_ROOT doesn't magically serve your media files. You still need something to serve them from there and expose them on MEDIA_URL.

Daniel Roseman