擅长:python、mysql、java
<p><a href="https://docs.djangoproject.com/en/dev/howto/static-files/" rel="nofollow">documentation</a>清楚地提到了如何设置媒体url。因此,view函数将为用户在开发过程中上传的文件提供服务。在</p>
<p>添加此代码段</p>
<pre><code>#urls.py
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)
</code></pre>