django 处理静态文件

settings:

STATIC_URL = 'static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

urls:

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

末尾加

+ static(settings.STATIC_URL, document_root = settings.STATIC_ROOT)

在模板里:

<script type="text/javascript" src="/static/js/jquery.js"></script>

猜你喜欢

转载自www.cnblogs.com/pythonClub/p/10355059.html
今日推荐