# xust-web **Repository Path**: azureroots/xust-web ## Basic Information - **Project Name**: xust-web - **Description**: No description available - **Primary Language**: Python - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-09 - **Last Updated**: 2025-09-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 1、安装uv ### 1.1、在线安装 #### 1.1.1、`Linux/macOS` Use `curl` to download the script and execute it with `sh`: ``` $ curl -LsSf https://astral.sh/uv/install.sh | sh ``` If your system doesn't have `curl`, you can use `wget`: ``` $ wget -qO- https://astral.sh/uv/install.sh | sh ``` Request a specific version by including it in the URL: ``` $ curl -LsSf https://astral.sh/uv/0.7.17/install.sh | sh ``` 安装后重启终端或执行 `source ~/.bashrc` 使 `uv` 生效。 #### 1.1.2、`Windows` Use `irm` to download the script and execute it with `iex`: ```powershell PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` Changing the [execution policy](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.4#powershell-execution-policies) allows running a script from the internet. Request a specific version by including it in the URL: ```powershell PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/0.7.17/install. ``` ### 1.2、离线安装 #### 1.2.1、Windows 从 QQ 群文件下载 `uv-x86_64-pc-windows-msvc.zip` 后将其解压到 `X:/bytecreek` 目录下。 随后将 `X:/bytecreek/uv` 路径配置到 环境变量的 `Path` 中即可。 通过`uv --version`命令来查看配置是否成功: ```cmd C:\Users\Administrator>uv --version uv 0.8.15 (8473ecba1 2025-09-03) ``` ### 1.3、安装Python 直接使用 `uv python install 3.13` 去安装时默认从 `github` 下载,所以可能会失败。 这里介绍用离线方式安装。 首先可以从以下地址下载相应的安装包: ```http https://github.com/astral-sh/python-build-standalone/releases/tag/20250902 ``` 我们从 QQ群文件中下载 `uv-python-standalone.7z.auto-unzip.exe` 文件,将其复制到 `X:/bytecreek` 目录中,双击即可解压。 然后在 **Windows资源管理器** 的地址栏中 输入 `%userprofile%` 后 回车即可打开当前用户主目录。 在用户主目录中添加 `uv.toml` 文件,其中内容如下: ```toml # uv.toml index-url = "https://pypi.tuna.tsinghua.edu.cn/simple" extra-index-url = ["https://mirrors.aliyun.com/pypi/simple/","https://repo.huaweicloud.com/repository/pypi/simple"] # 缓存与安装设置 cache-dir = "X:/bytecreek/uv_cache" # 自定义缓存路径 link-mode = "symlink" # 链接模式:symlink/copy/hardlink # 依赖解析策略 resolution = "highest" # 依赖解析策略:lowest/direct/highest # 使用本地文件来充当镜像 python-install-mirror = "file:///X:/bytecreek/uv-python-standalone" ``` 此处请务必注意: - `cache-dir` 必须是你自己机器的磁盘上的路径 - `python-install-mirror` 必须是本地机器上的路径,并且 前缀必须是 `file:///` 以上配置完成后,即可通过以下命令来安装 Python : ``` uv python install 3.13 ``` [Python versions](https://docs.astral.sh/uv/getting-started/features/#python-versions) Installing and managing Python itself. - `uv python install`: Install Python versions. - `uv python list`: View available Python versions. - `uv python find`: Find an installed Python version. - `uv python pin`: Pin the current project to use a specific Python version. - `uv python uninstall`: Uninstall a Python version. ## 2、管理项目 ### 2.1、初始化 通过 `uv init 项目名称` 可以创建并初始化一个 `uv` 项目,比如创建名称为 `hello` 的项目: ```sh X:\bytecreek\codes>uv init hello Initialized project `hello` at `X:\bytecreek\codes\hello` ``` 在执行完 `uv init` 之后会生成以下文件和目录: - `.git` 目录是本地 `Git` 仓库配置所在 - 注意该仓库默认并没有与任何远程仓库关联 - `.gitignore` 用于指定 `Git` 中需要忽略的目录和文件 - `.python-version` 用于设置当前项目正在使用的 Python 版本 - 可以通过配合 `uv python pin 版本号` 来使用 - `main.py` 是默认创建的一个 Python 脚本 - 可以通过 `uv run main.py` 来执行它 (请在激活虚拟环境后再执行) - `pyproject.toml` 是当前项目的配置文件 - 其中的 `requires-python` 决定了当前项目所必须使用的 `Python` 版本 可以通过修改 `requires-python` 的值来设置必须的 `Python` 版本 - `README.md` 项目说明文件 - 其中内容在远程 `Git` 仓库首页可以直接显式 ### 2.2、创建虚拟环境 进入到项目目录后,即可通过 `uv venv` 来**创建**虚拟环境,比如 ```sh X:\bytecreek\codes\hello>uv venv Using CPython 3.13.7 Creating virtual environment at: .venv Activate with: .venv\Scripts\activate ``` 由上可见,新创建的虚拟环境名称为 `.venv` 即 `uv venv` 等同于 `uv venv .venv`。 `uv venv .venv` 末尾的 `.venv` 是默认名称,可以省略为 `uv venv` 来直接创建。 当新创建的虚拟环境名称不是 `.venv` 时,可以显式指定该名称,比如 `uv venv first_venv` 。 ### 2.3、激活虚拟环境 创建好虚拟环境后,还要激活虚拟环境。 只有激活虚拟环境后它才有效,否则新建的虚拟环境将毫无意义。 不同的环境中激活虚拟环境的方式也有所不同,以下是常见的几种激活方式: - **Linux/macOS**: ```sh source .venv/bin/activate ``` - **Windows** 命令提示符: ```cmd .\.venv\Scripts\activate ``` - **Windows PowerShell** ```powershell .venv/Scripts/Activate.ps1 ``` ### 2.4、安装依赖 在确保激活虚拟环境后,即用 `uv add` 命令可为项目安装所需依赖: ```sh (hello) X:\bytecreek\codes\hello>uv add langchain-deepseek Resolved 35 packages in 40ms Installed 34 packages in 335ms + annotated-types==0.7.0 + anyio==4.10.0 + certifi==2025.8.3 + charset-normalizer==3.4.3 + colorama==0.4.6 + distro==1.9.0 + h11==0.16.0 + httpcore==1.0.9 + httpx==0.28.1 + idna==3.10 + jiter==0.10.0 + jsonpatch==1.33 + jsonpointer==3.0.0 + langchain-core==0.3.75 + langchain-deepseek==0.1.4 + langchain-openai==0.3.32 + langsmith==0.4.27 + openai==1.107.0 + orjson==3.11.3 + packaging==25.0 + pydantic==2.11.7 + pydantic-core==2.33.2 + pyyaml==6.0.2 + regex==2025.9.1 + requests==2.32.5 + requests-toolbelt==1.0.0 + sniffio==1.3.1 + tenacity==9.1.2 + tiktoken==0.11.0 + tqdm==4.67.1 + typing-extensions==4.15.0 + typing-inspection==0.4.1 + urllib3==2.5.0 + zstandard==0.24.0 ``` ### 2.5、编写脚本 编辑项目根目录的 `main.py` 文件,使其中内容为: ``` ``` ### 2.6、执行脚本 请确保在 命令提示符 或 PowerShell 中已经激活虚拟环境。 在激活虚拟环境后即可通过 `uv run` 命令来执行 Python 脚本,比如: ```cmd uv run main.py ``` 官方文档中关于 [Projects](https://docs.astral.sh/uv/getting-started/features/#projects) 的内容: Creating and working on Python projects, i.e., with a `pyproject.toml`. - `uv init`: Create a new Python project. - `uv add`: Add a dependency to the project. - `uv remove`: Remove a dependency from the project. - `uv sync`: Sync the project's dependencies with the environment. - `uv lock`: Create a lockfile for the project's dependencies. - `uv run`: Run a command in the project environment. - `uv tree`: View the dependency tree for the project. - `uv build`: Build the project into distribution archives. - `uv publish`: Publish the project to a package index. See the [guide on projects](https://docs.astral.sh/uv/guides/projects/) to get started. ## 3、管理依赖 ### 3.1、查看依赖树 树状列出当前项目下安装的所有依赖,可以通过以下命令实现: ```cmd uv tree ``` 比如: ```cmd X:\bytecreek\codes\hello>uv tree Resolved 38 packages in 1ms hello v0.1.0 ├── dotenv v0.9.9 │ └── python-dotenv v1.1.1 └── langchain-deepseek v0.1.4 ├── langchain-core v0.3.75 │ ├── jsonpatch v1.33 │ │ └── jsonpointer v3.0.0 │ ├── langsmith v0.4.25 │ │ ├── httpx v0.28.1 │ │ │ ├── anyio v4.10.0 │ │ │ │ ├── idna v3.10 │ │ │ │ ├── sniffio v1.3.1 │ │ │ │ └── typing-extensions v4.15.0 │ │ │ ├── certifi v2025.8.3 │ │ │ ├── httpcore v1.0.9 │ │ │ │ ├── certifi v2025.8.3 │ │ │ │ └── h11 v0.16.0 │ │ │ └── idna v3.10 │ │ ├── orjson v3.11.3 │ │ ├── packaging v25.0 │ │ ├── pydantic v2.11.7 │ │ │ ├── annotated-types v0.7.0 │ │ │ ├── pydantic-core v2.33.2 │ │ │ │ └── typing-extensions v4.15.0 │ │ │ ├── typing-extensions v4.15.0 │ │ │ └── typing-inspection v0.4.1 │ │ │ └── typing-extensions v4.15.0 │ │ ├── requests v2.32.5 │ │ │ ├── certifi v2025.8.3 │ │ │ ├── charset-normalizer v3.4.3 │ │ │ ├── idna v3.10 │ │ │ └── urllib3 v2.5.0 │ │ ├── requests-toolbelt v1.0.0 │ │ │ └── requests v2.32.5 (*) │ │ └── zstandard v0.24.0 │ ├── packaging v25.0 │ ├── pydantic v2.11.7 (*) │ ├── pyyaml v6.0.2 │ ├── tenacity v9.1.2 │ └── typing-extensions v4.15.0 └── langchain-openai v0.3.32 ├── langchain-core v0.3.75 (*) ├── openai v1.106.1 │ ├── anyio v4.10.0 (*) │ ├── distro v1.9.0 │ ├── httpx v0.28.1 (*) │ ├── jiter v0.10.0 │ ├── pydantic v2.11.7 (*) │ ├── sniffio v1.3.1 │ ├── tqdm v4.67.1 │ │ └── colorama v0.4.6 │ └── typing-extensions v4.15.0 └── tiktoken v0.11.0 ├── regex v2025.9.1 └── requests v2.32.5 (*) (*) Package tree already displayed ``` 另外,仅列出当前项目中已经安装的依赖列表,还可以通过以下命令实现: ```cmd uv pip list ``` 比如: ```cmd X:\bytecreek\codes\hello>uv pip list Package Version ------------------ -------- annotated-types 0.7.0 anyio 4.10.0 certifi 2025.8.3 charset-normalizer 3.4.3 colorama 0.4.6 distro 1.9.0 dotenv 0.9.9 h11 0.16.0 httpcore 1.0.9 httpx 0.28.1 idna 3.10 jiter 0.10.0 jsonpatch 1.33 jsonpointer 3.0.0 langchain-core 0.3.75 langchain-deepseek 0.1.4 langchain-openai 0.3.32 langsmith 0.4.25 openai 1.106.1 orjson 3.11.3 packaging 25.0 pydantic 2.11.7 pydantic-core 2.33.2 python-dotenv 1.1.1 pyyaml 6.0.2 regex 2025.9.1 requests 2.32.5 requests-toolbelt 1.0.0 sniffio 1.3.1 tenacity 9.1.2 tiktoken 0.11.0 tqdm 4.67.1 typing-extensions 4.15.0 typing-inspection 0.4.1 urllib3 2.5.0 zstandard 0.24.0 ``` 以上仅列出依赖名称及版本号,没有列出它们之间的关系。 ### 3.2、安装依赖 为当前项目安装依赖,可以通过以下命令实现: ```cmd uv add 依赖名称[==版本号] ``` 其中 `[==版本号]` 是可选的。 比如,直接安装 `langchain-deepseek` 而不显式设置版本可以使用: ```cmd uv add langchain-deepseek ``` 安装 `dotenv` 并显式指定版本可以通过以下形式实现: ```cmd uv add dotenv==0.9.9 ``` ### 3.3、移除依赖 若某个依赖不再被使用,或者版本安装错误,则可以将该依赖从工程中移除: ```cmd uv remove 依赖名称[==版本号] ``` 其中 `[==版本号]` 是可选的。 比如,卸载 `dotenv` 依赖: ```cmd X:\bytecreek\codes\hello>uv remove dotenv Resolved 36 packages in 1.50s Uninstalled 2 packages in 9ms - dotenv==0.9.9 - python-dotenv==1.1.1 ``` ### 3.4、同步依赖 一个项目所需要的依赖被通过 `pyproject.toml` 和 `uv.lock` 记录在项目中。 当从远程仓库将项目克隆到本地后,本地项目中是没有虚拟环境也没有相关依赖的。 因此我们应该首先在本地项目中**创建**虚拟环境: ```cmd uv venv ``` 随后将该虚拟环境**激活**,比如在 Windows系统的 命令提示符中可以使用以下形式激活: ``` .\.venv\Scripts\activate ``` 最后我们可以通过 `uv sync` 来**"安装"**依赖: ``` uv sync ``` 此时的 `uv` 会根据 `pyproject.toml` 中的配置和`uv.lock`中的记录来为当前虚拟环境安装依赖。 等所有依赖安装完毕,即可拥有与远程仓库作者一样的环境。 > 官方文档中对 `uv sync` 的说法是 “ Sync the project's dependencies with the environment ” ,翻译过来就是 “将项目的依赖项与环境同步”,实际上若依赖尚未安装,`uv` 会首先安装这些依赖。
重要提示: 多人协作的项目,应该通过 uv sync 来保证所有人使用的环境是相同的。
## 4、`xust-web` 如果你要克隆 `xust-web` 项目到本地主机,你应该按照以下步骤进行: 1. 克隆项目 ```sh git clone git@gitee.com:azureroots/xust-web.git ``` 2. 创建并激活虚拟环境 在 终端 或 命令提示符 中进入到项目根目录中,参照 `2.2` 接来创建虚拟环境、`2.3` 节来激活虚拟环境。 3. 同步依赖 ```sh uv sync ``` 以上操作完成后即可修改配置文件、启动项目。 后续仅记录构建 `xust-web` 项目的全过程,你只需了解即可。 ### 4.1、克隆仓库 首先在 `Gitee` 上创建了一个远程仓库,随后我们将其克隆到本地: ```cmd git clone git@gitee.com:azureroots/xust-web.git ``` 此时的 `xust-web` 项目中仅包含几个在 `Gitee`服务器上生成的文件而已,还不能算作是一个 `uv` 项目。 ### 4.2、初始化 进入到 `xust-web` 目录中,完成对项目的初始化: ```cmd uv init ``` 以上操作完成后可以在 `xust-web`目录下看到由`uv`为我们生成的相关文件和目录。(参见 `2.1` 节) ### 4.3、修改版本 在 `pyproject.toml` 中可以修改 `requires-python` 来设置当前项目需要的 `Python` 版本: ```toml [project] name = "xust-web" version = "0.1.0" description = "基于MVC的单表CRUD操作" readme = "README.md" requires-python = ">=3.10" dependencies = [] ``` ### 4.4、虚拟环境 参照 `2.2` 中的方法来为当前项目创建虚拟环境。 参照 `2.3` 中的方法来激活当前项目使用的虚拟环境。 ### 4.5、安装依赖 #### 4.5.1、`fastapi` [官网](https://fastapi.tiangolo.com/): `https://fastapi.tiangolo.com/` [中文文档](https://fastapi.tiangolo.com/zh/): `https://fastapi.tiangolo.com/zh/` 安装 `fastapi` : ```cmd X:\bytecreek\codes\xust-web>uv add fastapi Using CPython 3.13.7 Creating virtual environment at: .venv Resolved 12 packages in 820ms Installed 10 packages in 102ms + annotated-types==0.7.0 + anyio==4.10.0 + fastapi==0.116.1 + idna==3.10 + pydantic==2.11.7 + pydantic-core==2.33.2 + sniffio==1.3.1 + starlette==0.47.3 + typing-extensions==4.15.0 + typing-inspection==0.4.1 ``` #### 4.5.2、`uvicorn` 安装 `uvicorn`: ```cmd X:\bytecreek\codes\xust-web>uv add uvicorn Resolved 16 packages in 33ms Installed 4 packages in 49ms + click==8.2.1 + colorama==0.4.6 + h11==0.16.0 + uvicorn==0.35.0 ``` #### 4.5.3、`dotenv` ```cmd X:\bytecreek\codes\xust-web>uv add dotenv Resolved 18 packages in 158ms Installed 2 packages in 62ms + dotenv==0.9.9 + python-dotenv==1.1.1 ``` #### 4.5.4、`python-multipart` ```cmd X:\bytecreek\codes\xust-web>uv add python-multipart Resolved 19 packages in 30ms Installed 1 package in 12ms + python-multipart==0.0.20 ``` #### 4.5.5、`jinja2 ` ```cmd X:\bytecreek\codes\xust-web>uv add jinja2 Resolved 21 packages in 485ms Prepared 2 packages in 201ms Installed 2 packages in 17ms + jinja2==3.1.6 + markupsafe==3.0.2 ``` #### 4.5.6、`sqlalchemy` ```cmd X:\bytecreek\codes\xust-web>uv add sqlalchemy Resolved 23 packages in 1.01s Prepared 2 packages in 392ms Installed 2 packages in 133ms + greenlet==3.2.4 + sqlalchemy==2.0.43 ``` #### 4.5.7、`pymysql` ```cmd X:\bytecreek\codes\xust-web>uv add pymysql Resolved 24 packages in 181ms Prepared 1 package in 55ms Installed 1 package in 15ms + pymysql==1.1.2 ``` #### 4.5.8、`cryptography` ```cmd X:\bytecreek\codes\xust-web>uv add cryptography Resolved 27 packages in 1.13s Prepared 3 packages in 1.59s Installed 3 packages in 75ms + cffi==2.0.0 + cryptography==45.0.7 + pycparser==2.23 ``` ### 4.7、`main.py` 将 `main.py` 修改为以下形式: ```python from typing import Union from fastapi import FastAPI app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}") def read_item(item_id: int, q: Union[str, None] = None): return {"item_id": item_id, "q": q} ``` 以上内容来自 `fastapi` 官网。 ### 4.8、启动服务 可以使用以下方式来启动项目: ``` uv run uvicorn app.main:app --reload ``` 或者: ``` uv run python -m app.main ``` 或者: ``` uv run python -m uvicorn app.main:app --reload ``` 因为我们使用了 uv 来管理项目,因此应该使用以下命令来启动服务: ```cmd uv run uvicorn main:app --reload ``` 如果我们不是采用 `1.1、在线安装` 方式安装 uv 而是通过 `1.2、离线安装` 方式安装 `uv` ,则可能遇到以下错误: ```cmd (xust-web) X:\bytecreek\codes\xust-web>uv run uvicorn main:app --reload error: Failed to spawn: `uvicorn` Caused by: program not found ``` 针对以上错误,我们可以"曲线救国",采用以下命令来启动: ```cmd uv run python -m uvicorn main:app --reload ``` 比如: ```cmd (xust-web) X:\bytecreek\codes\xust-web>uv run python -m uvicorn main:app --reload INFO: Will watch for changes in these directories: ['X:\\bytecreek\\codes\\xust-web'] INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) INFO: Started reloader process [11208] using StatReload INFO: Started server process [9692] INFO: Waiting for application startup. INFO: Application startup complete. ``` 当服务启动成功后,即可在浏览器中通过以下路径来访问: - `http://127.0.0.1:8000` 对应 `main.py` 中的 `@app.get("/")` - `http://127.0.0.1:8000/items/1234` 对应 `main.py` 中的 `@app.get("/items/{item_id}")` - `http://127.0.0.1:8000/docs` 是关于当前项目中所有接口的文档 ### 4.9、处理静态资源 如果在项目下存在一个目录 ( 比如 `statics` ),其中存放了前端需要使用的 `HTML` 、`CSS` 、`JavaScript` 等文件,这些文件在浏览器中是无法直接访问的。 #### 4.9.1、映射路径 需要通过 `FastAPI` 将其映射为前端可以访问的路径: ``` app.mount("/static", StaticFiles(directory="statics"), name="static") ``` 其中: - `statics` 为项目根目录下的目录名称 - `/static` 表示映射后的路径,将来可以通过 `http://127.0.0.1:8000/static` 来访问 根据以上说明,修改后的 `main.py` 如下: ```python from fastapi import FastAPI from fastapi.staticfiles import StaticFiles app = FastAPI() # 1. 把 /static/* 路径永久映射到 statics 文件夹 # 比如通过 http://127.0.0.1:8000/static/css/home.css 就可以访问 statics/css/home.css 文件 app.mount("/static", StaticFiles(directory="statics"), name="static") @app.get("/") def read_root(): print("Hello from xust-web!") return {"Hello": "World"} @app.get("/items/{item_id}") def read_item(item_id: int): print(item_id) return {"item_id": item_id} ``` #### 4.9.2、展示首页 如果期望访问 `http://127.0.0.1:8000` 时能访问 `statics` 目录下的 `index.html` ,则需要在 `@app.get("/")`中予以处理: ``` @app.get("/") def home(): print("Welcome to xust-web homepage !") return Response(content=(Path("statics") / "index.html").read_bytes(), media_type="text/html") ``` 根据以上说明,修改后的 `main.py` 如下: ```python from fastapi import FastAPI, Response from fastapi.staticfiles import StaticFiles from pathlib import Path app = FastAPI() # 把 /static/* 路径永久映射到 statics 文件夹 # 比如通过 http://127.0.0.1:8000/static/css/home.css 就可以访问 statics/css/home.css 文件 app.mount("/static", StaticFiles(directory="statics"), name="static") @app.get("/") def home(): print("Welcome to xust-web homepage !") return Response(content=(Path("statics") / "index.html").read_bytes(), media_type="text/html") @app.get("/items/{item_id}") def read_item(item_id: int): print(item_id) return {"item_id": item_id} ``` #### 4.9.3、`Bootstrap` Bootstrap 官方网站(推荐来源) 👉 https://getbootstrap.com/ 这是 Bootstrap 的唯一官方站点,安全、权威、更新及时(当前最新版本为 Bootstrap 5.x,不再依赖 jQuery) 压缩包下载地址为: ```http https://getbootstrap.com/docs/5.3/getting-started/download/ ``` 点击 `Compiled CSS and JS ` 下方的 `Download` 按钮下载 `bootstrap-5.3.X-dist.zip` 。 ##### (1)、关于CSS文件 Bootstrap 官方压缩包中的 CSS 文件主要分为以下几类: 主要 CSS 文件: 1. **bootstrap.css / bootstrap.min.css** - 包含完整的 Bootstrap 框架,包括布局、内容、组件和实用工具 - `.min.css` 是压缩版本,适合生产环境使用 - **推荐**:这是你应该导入的主要文件,除非有特殊需求 2. **bootstrap-grid.css / bootstrap-grid.min.css** - 仅包含 Bootstrap 的网格系统 - 只包含布局相关的样式和弹性盒子实用工具 - **用途**:当你只需要使用 Bootstrap 的网格布局,而不需要其他组件时使用 3. **bootstrap-utilities.css / bootstrap-utilities.min.css** - 仅包含 Bootstrap 的实用工具类(如间距、颜色、显示等) - **用途**:当你只需要使用 Bootstrap 的实用工具类时使用 4. **bootstrap-reboot.css / bootstrap-reboot.min.css** - 仅包含 Bootstrap 的 Reboot 样式(浏览器标准化样式) - **用途**:当你只需要浏览器样式重置时使用 特殊版本: 1. **bootstrap.rtl.css / bootstrap.rtl.min.css** - 从右到左(RTL)语言支持的版本 - **用途**:为阿拉伯语、希伯来语等 RTL 语言设计的版本 辅助文件: 1. **.map 文件(Source Maps)** - 用于浏览器开发者工具调试 - 帮助你在调试时看到原始的 Sass 源码 - **用途**:开发调试时使用,生产环境通常不需要 ##### (2)、关于JavaScript文件 核心文件(二选一,只能选一个) 1. bootstrap.bundle.js / bootstrap.bundle.min.js ‑ 已 **自带 Popper**(定位引擎,下拉、提示框、弹层等组件依赖它)。 ‑ 体积稍大,但 **最省事**。 ‑ 生产环境直接引 `bootstrap.bundle.min.js` 即可。 2. bootstrap.js / bootstrap.min.js ‑ **不带 Popper**。 ‑ 如果你想自己单独控制 Popper 版本,或已经通过 CDN/npm 另外引了 Popper,就用这个。 ‑ 记得在它之前先引 Popper(顺序:Popper → bootstrap.js)。 ------ 独立拆出来的单个组件文件(按需加载才用) 目录里还会看到一堆 `bootstrap.<组件>.js`(如 `bootstrap.modal.js`、`bootstrap.dropdown.js` …)。 这些是 **Webpack / Rollup / Vite 等模块化打包场景** 用的,方便“只引下拉框就绝不把轮播打包进去”。 **传统 `