How does Django serve media files?

前端 未结 5 504
谎友^
谎友^ 2021-01-02 05:01

I have set up a Django application that uses images. I think I have set up the media settings MEDIA_ROOT and MEDIA_URL correctly. However the images don\'t show up. Do you k

5条回答
  •  北荒
    北荒 (楼主)
    2021-01-02 05:39

    I'm aware that the original question is with the dev server, but for anyone else who is looking for a production environment answer:

    https://docs.djangoproject.com/en/1.8/howto/static-files/deployment/ provides a guide on how to have django serve files in a production environment. From the tone of the guide, it does seem to imply that it is best to have a separate web server to handle the files or use mod_wsgi with Apache

提交回复
热议问题