Django静态文件目录配置
参考:https://docs.djangoproject.com/en/3.0/howto/static-files/
编辑setting.py
:
INSTALLED_APPS = [
...
'django.contrib.staticfiles',
]
...
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
<!DOCTYPE html>
<html lang="zh">
{% load static %}
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>AppBlog.CN</title>
<link href="{% static 'layui/css/layui.css' %}" rel="stylesheet" type="text/css" />
<script src="{% static 'layui/layui.js' %}" type="text/javascript" charset="utf-8"></script>
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/04/01/django-static-file-directory-configuration/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
打赏
海报
Django静态文件目录配置
参考:https://docs.djangoproject.com/en/3.0/howto/static-files/
编辑setting.py:
INSTALLED_APPS = [
...
'django.contrib.staticfiles……
文章目录
关闭
共有 0 条评论