diff --git a/README.md b/README.md index 684b078eb1d213ab351f5ea0ba81337719db4d8c..10db7f526ce51cae90d03d20fa104c6567780fad 100644 --- a/README.md +++ b/README.md @@ -103,21 +103,25 @@ yarn run dev 1. enter code dir cd backend 2. copy ./conf/env.example.py to ./conf dir,rename as env.py 3. in env.py configure database information - mysql database recommended version: 8.0 - mysql database character set: utf8mb4 -4. install pip dependence - pip3 install -r requirements.txt -5. Execute the migration command: - python3 manage.py makemigrations - python3 manage.py migrate -6. Initialization data - python3 manage.py init -7. Initialize provincial, municipal and county data: - python3 manage.py init_area -8. start backend - python3 manage.py runserver 0.0.0.0:8000 -or uvicorn : - uvicorn application.asgi:application --port 8000 --host 0.0.0.0 --workers 8 + mysql database recommended version: 8.0 + mysql database character set: utf8mb4 +4. Activate the virtual environment (optional) + python3 -m venv myenv + .\myenv\Scripts\activate (Windows) + source myenv/bin/activate (Linux | MacOS) +5. install pip dependence + pip3 install -r requirements.txt +6. Execute the migration command: + python3 manage.py makemigrations + python3 manage.py migrate +7. Initialization data + python3 manage.py init +8. Initialize provincial, municipal and county data: + python3 manage.py init_area +9. start backend + python3 manage.py runserver 0.0.0.0:8000 + or daphne : + daphne -b 0.0.0.0 -p 8000 application.asgi:application ~~~ ### visit backend swagger diff --git a/README.zh.md b/README.zh.md index e3e104827df74a6889d4175e6057b1a689b15954..2322a2fc9cd49f66d1f647684bcc3b73fb71c4e2 100644 --- a/README.zh.md +++ b/README.zh.md @@ -151,20 +151,25 @@ yarn build 3. 在 env.py 中配置数据库信息 mysql数据库版本建议:8.0 mysql数据库字符集:utf8mb4 -4. 安装依赖环境 +4. 激活虚拟环境(可选) + python3 -m venv myenv + .\myenv\Scripts\activate (Windows) + source myenv/bin/activate (Linux | MacOS) +5. 安装依赖环境 pip3 install -r requirements.txt -5. 执行迁移命令: +6. 执行迁移命令: python3 manage.py makemigrations python3 manage.py migrate -6. 初始化数据 +7. 初始化数据 python3 manage.py init -7. 初始化省市县数据: +8. 初始化省市县数据: python3 manage.py init_area -8. 启动项目 +9. 启动项目 python3 manage.py runserver 0.0.0.0:8000 -或使用 uvicorn : - uvicorn application.asgi:application --port 8000 --host 0.0.0.0 --workers 8 + 或使用 daphne : + daphne -b 0.0.0.0 -p 8000 application.asgi:application ~~~ + ## 开发建议 前后端backend与web各自单独一个窗口打开进行开发 diff --git a/backend/requirements.txt b/backend/requirements.txt index 9cae2cca7e0fe4085fa49dec92d9f5203dd10aea..0ad9914387b78313eb115b2edb231969e2e5688e 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -9,7 +9,7 @@ django-simple-captcha==0.6.0 django-timezone-field==7.0 djangorestframework-simplejwt==5.3.1 drf-yasg==1.21.7 -mysqlclient==2.2.0 +mysqlclient==2.2.7 pypinyin==0.51.0 ua-parser==0.18.0 pyparsing==3.1.2 diff --git a/web/.env.development b/web/.env.development index dc36b291b2cdf3991de42c0cb05648f397f5e173..1c3ca5db362e1f7935aded834e08f0a46ed640a6 100644 --- a/web/.env.development +++ b/web/.env.development @@ -2,7 +2,7 @@ ENV = 'development' # 本地环境接口地址 -VITE_API_URL = 'http://127.0.0.1:8001' +VITE_API_URL = 'http://127.0.0.1:8000' # 是否启用按钮权限 VITE_PM_ENABLED = true diff --git a/web/package.json b/web/package.json index 61d8bc49da6b53bce7b88b574d4b192e8c89414f..73d9bdcf3d4bd469c14706696a5cc56a135bfeba 100644 --- a/web/package.json +++ b/web/package.json @@ -5,7 +5,7 @@ "license": "MIT", "scripts": { "dev": "vite --force", - "build:dev":"vite build --mode development", + "build:dev": "vite build --mode development", "build": "vite build", "build:local": "vite build --mode local_prod", "lint-fix": "eslint --fix --ext .js --ext .jsx --ext .vue src/" @@ -19,6 +19,8 @@ "@great-dream/dvadmin3-celery-web": "^3.1.3", "@iconify/vue": "^4.1.2", "@types/lodash": "^4.17.7", + "@typescript-eslint/eslint-plugin": "^8.29.0", + "@typescript-eslint/parser": "^8.29.0", "@vitejs/plugin-vue-jsx": "^4.0.1", "@wangeditor/editor": "^5.1.23", "@wangeditor/editor-for-vue": "^5.1.12", @@ -58,14 +60,13 @@ "vue-i18n": "^9.14.0", "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", "@vitejs/plugin-vue": "^5.1.2", "@vue/compiler-sfc": "^3.4.38", "eslint": "^9.9.0",