django加载静态文件

1.setting.py
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "staticDirectory"),
)
2.html
{% load static %}
<link rel="stylesheet" type="text/css" href="{%static 'css/x.css'%}"/>

原文地址:https://www.cnblogs.com/mznsndy/p/11436746.html