django1.9引入js,css文件


settings.py

STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)

templates/hello.html

{% load staticfiles %}#这句添加在html文件的最上面
<script src="{% static "js/jquery-3.1.1.min.js" %}" type="text/javascript"></script>
#注意看这里面的script标签和我们之前的script标签之间的不同

https://blog.csdn.net/snow_iscas/article/details/54177910

css的话格式有点不同了

猜你喜欢

转载自www.cnblogs.com/dycsy/p/8980623.html