django media_root not working

1.9k views Asked by At

I'm using django 1.6

in my settings I have this, which works fine,

STATICFILES_DIRS = (

    os.path.join(BASE_DIR, 'static/'),

)

but the moment I add: `MEDIA_ROOT = os.path.join(BASE_DIR, 'media/'),

I get a error while rendering a template:

'tuple' does not support the buffer interface

problem code: <link href=" {% static 'bootstrap/css/bootstrap.min.css' %} " rel="stylesheet">

Is there some kind of conflict between these 2 settings? all I'm trying to do is serve user uploaded files, should I just change the upload_to setting to the static directory?

has anyone experienced this before or know what might be the problem

any help is appreciated, thanks

2

There are 2 answers

0
makketagg On BEST ANSWER

just fixed your string in settings.py

Your

MEDIA_ROOT = os.path.join(BASE_DIR, 'media/'),

Fixed

MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')

Without ,

0
Sakil Rohman On

Instead of importing the os library, you should import os.path, as done followingly:

import os.path