gpt4 book ai didi

python - Django 对 `MEDIA_ROOT` 做什么?

转载 作者:太空狗 更新时间:2023-10-29 20:16:19 28 4
gpt4 key购买 nike

Django 对 MEDIA_ROOT 到底做了什么?我一直不明白。由于 Django 本身不提供静态媒体服务,您必须为其设置 apache 或类似的东西,为什么它关心它位于哪个目录?

最佳答案

您不是唯一想知道的人;查看Django ticket #10650 .根据 Django 开发人员的评论,我认为这几乎概括了 MEDIA_ROOT 的用途:

Unfortunately, Django is also at fault for being far too vague in its docs about what MEDIA_ROOT and MEDIA_URL are used for. Searching through Django's code confirms that MEDIA_ROOT & MEDIA_URL are used for file upload, and that MEDIA_URL is provided as a convenience to templates via the default context processors (available when using RequestContext??).

关于python - Django 对 `MEDIA_ROOT` 做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2303254/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com