python - 添加 CSS 文件后出现黑屏
问题描述
已下载 Bootstrap 编译的 CSS 和 JS 版本(Bootstrap v4.0.0)。但是当我在 cmd 提示符上运行它时。它只显示空白屏幕,但是当我删除 css 文件时,它显示基本的 HTML 页面。我认为链接我的 css 文件时存在一些问题。
目录看起来像
myproject/
|-- myproject/
| |-- boards/
| |-- myproject/
| |-- templates/
| |-- static/
| | +-- css/
| | +-- bootstrap.min.css.map <-- here
| +-- manage.py
+-- venv/
DEBUG 为真,安装了 django.contrib.staticfiles
我的 settings.py 文件代码看起来像
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
Home.html 文件看起来像
{% load static %}<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Boards</title>
<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
</head>
<body>
<!-- body suppressed for brevity ... -->
</body>
</html>
请帮忙!
解决方案
推荐阅读
- mysql - Oracle/SQL/My-Sql 查询中的自定义列?
- flutter - 如何让 Flutter 响应 Web?不工作:MediaQuerys、固定像素和 BoxConstraints 等
- python - 如何同时遍历几个 api 调用和几个字典键?
- wordpress - 如何在 Wordpress 中更改帖子名称固定链接?
- python - 用于保存数据的 Python 矩阵 - NumPy
- node.js - process.mainModule 在 nodejs 中已弃用
- c# - 减少 TreeView 使用的水平空间
- visual-studio-code - 如何在 Visual Studio Code 中将 pyodbc 添加到 Azure Functions?
- sql - Left Join 奇怪地对输出数据进行排序
- ssis - SSIS 变量文件名