From af459aa12a90708560da7f171391a3991751e9ab Mon Sep 17 00:00:00 2001 From: leviio Date: Fri, 12 Dec 2025 17:08:40 +0800 Subject: [PATCH 1/4] =?UTF-8?q?-=20=E9=87=8D=E5=86=99=20README.zh=20?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E3=80=8C=E5=90=8E=E7=AB=AF=E3=80=8D=E9=83=A8?= =?UTF-8?q?=E5=88=86=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=88=9B=E5=BB=BA=E8=99=9A?= =?UTF-8?q?=E6=8B=9F=E7=8E=AF=E5=A2=83=E7=9A=84=E8=AF=B4=E6=98=8E=20-=20?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=20requirements.txt=20=E4=B8=AD=E7=9A=84psyco?= =?UTF-8?q?pg2=E5=8C=85=EF=BC=8C=E5=9B=A0=E4=B8=BA=E6=9C=AC=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=BD=BF=E7=94=A8=E7=9A=84=E6=98=AFmysql=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=EF=BC=8C=E4=B8=8D=E6=98=AF=E4=BD=BF=E7=94=A8?= =?UTF-8?q?PostgreSQL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.zh.md | 38 ++++++++++++++++++-------------------- backend/requirements.txt | 1 - 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/README.zh.md b/README.zh.md index e3e104827..ca64df346 100644 --- a/README.zh.md +++ b/README.zh.md @@ -146,27 +146,25 @@ yarn build ## 后端💈 ~~~bash -1. 进入项目目录 cd backend -2. 在项目根目录中,复制 ./conf/env.example.py 文件为一份新的到 ./conf 文件夹下,并重命名为 env.py -3. 在 env.py 中配置数据库信息 - mysql数据库版本建议:8.0 - mysql数据库字符集:utf8mb4 -4. 安装依赖环境 - pip3 install -r requirements.txt -5. 执行迁移命令: - python3 manage.py makemigrations - python3 manage.py migrate -6. 初始化数据 - python3 manage.py init -7. 初始化省市县数据: - python3 manage.py init_area -8. 启动项目 - python3 manage.py runserver 0.0.0.0:8000 -或使用 uvicorn : - uvicorn application.asgi:application --port 8000 --host 0.0.0.0 --workers 8 +cd backend # 进入项目目录 +python -m venv venv # 创建虚拟环境 +source venv/bin/activate # 进入虚拟环境 +pip3 install -r requirements.txt # 安装依赖 + +# 执行迁移命令: +python3 manage.py makemigrations +python3 manage.py migrate + +# 初始化数据 +python3 manage.py init +# 初始化省市县数据: +python3 manage.py init_area +# 启动项目 +python3 manage.py runserver 0.0.0.0:8000 + +# 或使用 uvicorn : +uvicorn application.asgi:application --port 8000 --host 0.0.0.0 --workers 8 ~~~ -## 开发建议 -前后端backend与web各自单独一个窗口打开进行开发 ### 访问项目 diff --git a/backend/requirements.txt b/backend/requirements.txt index f443f6f09..5837ef728 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -22,7 +22,6 @@ channels-redis==4.2.0 user-agents==2.2.0 six==1.16.0 whitenoise==6.7.0 -psycopg2==2.9.9 uvicorn==0.30.3 gunicorn==23.0.0 gevent==24.2.1 -- Gitee From d00faff2d3fcaa49d886954af51adfdd35c9cfe3 Mon Sep 17 00:00:00 2001 From: leviio Date: Fri, 12 Dec 2025 18:13:14 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/package.json | 10 ++++++---- web/vite.config.ts | 15 +++++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/web/package.json b/web/package.json index 2a57a86c0..3bcc8f02c 100644 --- a/web/package.json +++ b/web/package.json @@ -69,21 +69,23 @@ "vue-qr": "^4.0.9", "vue-router": "^4.4.3", "vxe-table": "^4.6.18", - "xe-utils": "^3.5.30" + "xe-utils": "^3.5.30", + "yarn": "^1.22.22" }, "devDependencies": { "@types/node": "^18.19.42", "@types/nprogress": "^0.2.3", "@types/sortablejs": "^1.15.8", - "@typescript-eslint/eslint-plugin": "^5.46.0", - "@typescript-eslint/parser": "^5.46.0", + "@typescript-eslint/eslint-plugin": "^8.0.0", + "@typescript-eslint/parser": "^8.0.0", "@vitejs/plugin-vue": "^5.1.2", + "@vitejs/plugin-vue-jsx": "^4.0.1", "@vue/compiler-sfc": "^3.4.38", "eslint": "^9.9.0", "eslint-plugin-vue": "^9.27.0", "prettier": "^2.8.1", "sass": "^1.56.2", - "typescript": "^4.9.4", + "typescript": "^5.0.0", "vite": "^5.4.1", "vite-plugin-vue-setup-extend": "^0.4.0", "vue-eslint-parser": "^9.4.3" diff --git a/web/vite.config.ts b/web/vite.config.ts index d6ebf2679..99fbf932e 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -2,8 +2,9 @@ import vue from '@vitejs/plugin-vue'; import { resolve } from 'path'; import { defineConfig, loadEnv, ConfigEnv } from 'vite'; import vueSetupExtend from 'vite-plugin-vue-setup-extend'; -import vueJsx from '@vitejs/plugin-vue-jsx' -import { generateVersionFile } from "/@/utils/upgrade"; +import fs from 'fs'; +import * as process from 'process'; +// 不使用 @vitejs/plugin-vue-jsx 插件,避免 ESM/CJS 兼容性问题 const pathResolve = (dir: string) => { return resolve(__dirname, '.', dir); @@ -20,9 +21,15 @@ const alias: Record = { const viteConfig = defineConfig((mode: ConfigEnv) => { const env = loadEnv(mode.mode, process.cwd()); // 当Vite构建时,生成版本文件 - generateVersionFile() + if (mode.command === 'build') { + // 生成版本文件到public目录下version文件中 + const VERSION_FILE_NAME = 'version-build'; + const package_version = process.env.npm_package_version; + const version = `${package_version}.${new Date().getTime()}`; + fs.writeFileSync(`public/${VERSION_FILE_NAME}`, version); + } return { - plugins: [vue(), vueJsx(), vueSetupExtend()], + plugins: [vue(), vueSetupExtend()], root: process.cwd(), resolve: { alias }, base: mode.command === 'serve' ? './' : env.VITE_PUBLIC_PATH, -- Gitee From dfe2010951b5776cc35a9ccb2c8c8ac995833f29 Mon Sep 17 00:00:00 2001 From: leviio Date: Fri, 12 Dec 2025 18:14:21 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BC=98=E5=8C=96readme=EF=BC=8C=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.zh.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.zh.md b/README.zh.md index ca64df346..d5708699f 100644 --- a/README.zh.md +++ b/README.zh.md @@ -134,7 +134,7 @@ npm install yarn yarn install --registry=https://registry.npmmirror.com # 启动服务 -yarn build +yarn dev # 浏览器访问 http://localhost:8080 # .env.development 文件中可配置启动端口等参数 # 构建生产环境 -- Gitee From fb168e8ca35746193f0eb7320f8f725bb31b4648 Mon Sep 17 00:00:00 2001 From: leviio Date: Sat, 13 Dec 2025 15:09:08 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 12bc2b3ee..a192474fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /backend/venv /backend/.idea .idea +.DS_Store .history/ .vscode/ -- Gitee