當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python Django static用法及代碼示例

本文介紹 django.conf.urls.static.static 的用法。

聲明

static.static(prefix, view=django.views.static.serve, **kwargs)

幫助函數返回用於在調試模式下提供文件的 URL 模式:

from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    # ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

相關用法


注:本文由純淨天空篩選整理自djangoproject.com大神的英文原創作品 django.conf.urls.static.static。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。