Django not recognizing the MEDIA_URL path?

前端 未结 8 1831
鱼传尺愫
鱼传尺愫 2021-02-03 13:23

So I\'m trying to get TinyMCE up and running on a simple view function, but the path to the tiny_mce.js file gets screwed up. The file is located at /Users/home/Django/tinyMCE/m

8条回答
  •  隐瞒了意图╮
    2021-02-03 13:50

    Thanks a lot for your help everyone. I was able to solve it as

    settings.py -->

    MEDIA_ROOT = '/home/patrick/Documents/code/projects/test/media/'
    MEDIA_URL = 'http://localhost:8000/media/'
    

    urls.py -->

    (r'^media/(?P,*)$', 'django.views.static.serve',{'document_root': settings.MEDIA_ROOT}),
    

    index.html -->

    img src="/media/images/logo.jpg"
    

    Again, thanks a lot, I was going crazy trying to find out how to do all of this. This solution worked for me on a Django version 1.2.5 Development server running Ubuntu 10.04.

提交回复
热议问题