html 静态文件导入问题
来源:9-2 dashboard搭建与管理员模块开发(2)

coderer
2019-12-16
settings:
INSTALLED_APPS = [
‘django.contrib.admin’,
‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.messages’,
‘django.contrib.staticfiles’,
‘app’
]
STATIC_URL = '/static/'
STATICFILES = (os.path.join(BASE_DIR, ‘static’),)
html:
</script src="/static/dashboard/js/jquery-1.12.4.min.js"><//script>
</script src="/static/dashboard/js/bootstrap.min.js"><//script>
脚本标签前的‘/’ 特意加的,,不然会被屏蔽
静态文件路径:video\static\dashboard
后台错误:
[16/Dec/2019 15:12:39] “GET /static/dashboard/css/bootstrap.min.css HTTP/1.1” 404 1717
[16/Dec/2019 15:12:39] “GET /static/dashboard/js/jquery-1.12.4.min.js HTTP/1.1” 404 1723
[16/Dec/2019 15:12:39] “GET /static/dashboard/js/bootstrap.min.js HTTP/1.1” 404 1711
1回答
-
不加/ 就是走相对路径
052019-12-16
相似问题