Django not recognizing the MEDIA_URL path?

前端 未结 8 1839
鱼传尺愫
鱼传尺愫 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:47

    Please read the official Django DOC carefully and you will find the most fit answer.

    The best and easist way to solve this is like below.

    from django.conf import settings
    from django.conf.urls.static import static
    
    urlpatterns = patterns('',
        # ... the rest of your URLconf goes here ...
    ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    

    The related url is: https://docs.djangoproject.com/en/1.5/howto/static-files/#serving-files-uploaded-by-a-user

提交回复
热议问题