# 溧水民健体检中心 **Repository Path**: zeron2022/MinJianTiJian ## Basic Information - **Project Name**: 溧水民健体检中心 - **Description**: No description available - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2025-04-02 - **Last Updated**: 2025-04-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 蚂蚁后台 ## 1.项目的环境搭建 1.1 python版本需求 `python > 3.8` 1.2 安装环境 `pip install -r requirements.txt` 1.3 配置mysql数据库 `mysql8.0` 1.3.1 连接创建好的数据库 `mysql -u root -p` 1.3.2 新建数据库 ```shell python manage.py makemigrations python manage.py migrate ``` 1.4 启动项目 1.4.1 本地启动 ```shell pyhton manage.py runserver 0.0.0.0:8000 ``` 1.4.1 线上启动 ```shell uwsgi --ini uwsgi.ini [注]需要配置好nginx ``` 1.5 访问 1.5.1 本地 http://127.0.0.1:8000 1.5.1 线上 https://mp.mayi-healthcare.cn 1.6 线上接口文档 https://mp.mayi-healthcare.cn/swagger/ 1.7 项目配置文件位置 1.7.1 项目启动环境配置 `Services/.env` 1.7.2 项目前端及商城配置 `common/config.py` ## 2.1 线上项目部署文档 2.1.1 linux本地部署 ```shell 安装uwsgi uwsgi配置参见uwsgi.ini ``` 2.1.2 nginx配置 ```shell server { listen 80; server_name mp.mayi-healthcare.cn; rewrite ^(.*)$ https://$host$1 permanent; } server { listen 443; server_name mp.mayi-healthcare.cn; location ^~ / { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; add_header X-Cache $upstream_cache_status; #Set Nginx Cache set $static_file1ulEVZIP 0; if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" ) { set $static_file1ulEVZIP 1; expires 12h; } if ( $static_file1ulEVZIP = 0 ) { add_header Cache-Control no-cache; } } ssl on; ssl_certificate /etc/nginx/cert/ant.fly-santa.com/fullchain.pem; ssl_certificate_key /etc/nginx/cert/ant.fly-santa.com/privkey.pem; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; } [注] 需要获取ssl证书 注意证书位置在/etc/nginx/cert/ ``` ## 3.1 项目的第三方库说明 3.1.1 定时任务库 django-apscheduler ```shell 跟随项目自启动 不需要在额外启动 手动开始与关闭位置 Message/views.py scheduler.start() ``` 3.1.2 异步任务库django-rq ```shell # 启动django-rq异步任务 python manage.py rqworker default # 以守护进程的方式运行 python manage.py rqworker default --daemon ``` 3.1.3 项目后台admin第三方ui框架 `Simple UI` ```shell 替换部分源码 /attached/index.html ==> simpleui/static/admin/index.html /attached/index.js ==> simpleui/templates/admin/simpleui-x/index.js 优化了后台页面 ``` 3.1.4 项目后台第三方ui框架 `element` https://element.eleme.cn/#/zh-CN/component/installation ```shell 后台的所有交互组件都是使用的是element ```