开发者

Django; media not being served?

I've made a simple user profile editor for a django project. And it has the ability to let the user upload an avatar image.

The thing is i can't access the image file, using

http://127.0.0.1:8080/media/avatars/filename.png

i think i have set media_root and media_url set correctly:

MEDIA_ROOT = 'C:/<path>/<to>/<media>/media/'
MEDIA_URL = '/media/'

The images gets uploaded correc开发者_Python百科tly in the correct folder ('avatars'), but django appears not to serve them (or anything) at the media url.

What am i missing?


did you put the something like this in the urls.py

urlpatterns += patterns('',
    (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT }),
)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜