1. settings.py最下方STATIC_URL下面补上
STATIC_URL = ‘/home/wjg/code/wblog/static/‘
STATIC_ROOT = os.path.join(os.path.dirname(__file__),‘../static‘).replace(‘\\‘,‘/‘)
STATICFILES_DIRS = (
(‘css‘,os.path.join(STATIC_ROOT,‘css‘).replace(‘\\‘,‘/‘) ),
(‘js‘,os.path.join(STATIC_ROOT,‘js‘).replace(‘\\‘,‘/‘) ),
(‘images‘,os.path.join(STATIC_ROOT,‘images‘).replace(‘\\‘,‘/‘) ),
)
3.html引用办法
<link rel="stylesheet" type="text/css" href="/static/css/bootstrap/css/bootstrap.css">
时间: 2024-10-27 07:10:49