初始化更新
This commit is contained in:
4
.gitattributes
vendored
Normal file
4
.gitattributes
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
*.css linguist-language=Python
|
||||
*.less linguist-language=Python
|
||||
*.js linguist-language=Python
|
||||
*.html linguist-language=Python
|
||||
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/backend/venv
|
||||
/backend/.idea
|
||||
.idea
|
||||
|
||||
.history/
|
||||
.vscode/
|
||||
201
LICENSE
Normal file
201
LICENSE
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [2022] [django-vue-admin]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
13
NOTICE
Normal file
13
NOTICE
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright 2021 李强
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
209
README.md
209
README.md
@@ -1,37 +1,196 @@
|
||||
# django-vue3-admin
|
||||
# Django-Vue-Admin
|
||||
|
||||
#### 介绍
|
||||
django-vue3-admin
|
||||
[](https://gitee.com/liqianglog/django-vue-admin/blob/master/LICENSE) [](https://python.org/) [](https://docs.djangoproject.com/zh-hans/3.2/) [](https://nodejs.org/zh-cn/) [](https://gitee.com/liqianglog/django-vue-admin)
|
||||
|
||||
#### 软件架构
|
||||
软件架构说明
|
||||
[预 览](https://demo.django-vue-admin.com) | [官网文档](https://www.django-vue-admin.com) | [群聊](https://qm.qq.com/cgi-bin/qm/qr?k=fOdnHhC8DJlRHGYSnyhoB8P5rgogA6Vs&jump_from=webapi) | [社区](https://bbs.django-vue-admin.com) | [插件市场](https://bbs.django-vue-admin.com/plugMarket.html) | [Github](https://github.com/liqianglog/django-vue-admin)
|
||||
|
||||
|
||||
#### 安装教程
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
💡 **「关于」**
|
||||
|
||||
#### 使用说明
|
||||
我们是一群热爱代码的青年,在这个炙热的时代下,我们希望静下心来通过Code带来一点我们的色彩和颜色。
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
因为热爱,所以拥抱未来
|
||||
|
||||
#### 参与贡献
|
||||
## 平台简介
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
💡 [django-vue-admin](https://gitee.com/dvadmin/django-vue-admin) 是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
|
||||
|
||||
|
||||
|
||||
* 🧑🤝🧑前端采用[D2Admin](https://github.com/d2-projects/d2-admin) 、[Vue](https://cn.vuejs.org/)、[ElementUI](https://element.eleme.cn/)。
|
||||
* 👭后端采用 Python 语言 Django 框架以及强大的 [Django REST Framework](https://pypi.org/project/djangorestframework)。
|
||||
* 👫权限认证使用[Django REST Framework SimpleJWT](https://pypi.org/project/djangorestframework-simplejwt),支持多终端认证系统。
|
||||
* 👬支持加载动态权限菜单,多方式轻松权限控制。
|
||||
* 💏特别鸣谢:[D2Admin](https://github.com/d2-projects/d2-admin) 、[Vue-Element-Admin](https://github.com/PanJiaChen/vue-element-admin)。
|
||||
* 💡 特别感谢[jetbrains](https://www.jetbrains.com/) 为本开源项目提供免费的 IntelliJ IDEA 授权。
|
||||
|
||||
|
||||
|
||||
## 在线体验
|
||||
|
||||
👩👧👦演示地址:[http://demo.django-vue-admin.com](http://demo.django-vue-admin.com)
|
||||
|
||||
- 账号:superadmin
|
||||
|
||||
- 密码:admin123456
|
||||
|
||||
👩👦👦文档地址:[https://django-vue-admin.com](https://django-vue-admin.com)
|
||||
|
||||
|
||||
|
||||
## 交流
|
||||
|
||||
- 交流社区:[戳我](https://bbs.django-vue-admin.com)👩👦👦
|
||||
|
||||
- 插件市场:[戳我](https://bbs.django-vue-admin.com/plugMarket.html)👩👦👦
|
||||
|
||||
- django-vue-admin交流01群(已满):812482043 [点击链接加入群聊](https://qm.qq.com/cgi-bin/qm/qr?k=aJVwjDvH-Es4MPJQuoO32N0SucK22TE5&jump_from=webapi)
|
||||
- django-vue-admin交流02群:687252418 [点击链接加入群聊](https://qm.qq.com/cgi-bin/qm/qr?k=4jJN4IjWGfxJ8YJXbb_gTsuWjR34WLdc&jump_from=webapi)
|
||||
|
||||
- 二维码
|
||||
|
||||
<img src='https://images.gitee.com/uploads/images/2022/0530/233203_5fb11883_5074988.jpeg' width='200'>
|
||||
|
||||
## 源码地址
|
||||
|
||||
gitee地址(主推):[https://gitee.com/liqianglog/django-vue-admin](https://gitee.com/liqianglog/django-vue-admin)👩👦👦
|
||||
|
||||
github地址:[https://github.com/liqianglog/django-vue-admin](https://github.com/liqianglog/django-vue-admin)👩👦👦
|
||||
|
||||
|
||||
|
||||
## 内置功能
|
||||
|
||||
1. 👨⚕️菜单管理:配置系统菜单,操作权限,按钮权限标识、后端接口权限等。
|
||||
2. 🧑⚕️部门管理:配置系统组织机构(公司、部门、角色)。
|
||||
3. 👩⚕️角色管理:角色菜单权限分配、数据权限分配、设置角色按部门进行数据范围权限划分。
|
||||
4. 🧑🎓权限权限:授权角色的权限范围。
|
||||
5. 👨🎓用户管理:用户是系统操作者,该功能主要完成系统用户配置。
|
||||
6. 👬接口白名单:配置不需要进行权限校验的接口。
|
||||
7. 🧑🔧字典管理:对系统中经常使用的一些较为固定的数据进行维护。
|
||||
8. 🧑🔧地区管理:对省市县区域进行管理。
|
||||
9. 📁附件管理:对平台上所有文件、图片等进行统一管理。
|
||||
10. 🗓️操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
|
||||
11. 🔌[插件市场 ](https://bbs.django-vue-admin.com/plugMarket.html):基于Django-Vue-Admin框架开发的应用和插件。
|
||||
|
||||
## 插件市场 🔌
|
||||
|
||||
- Celery异步任务:[dvadmin-celery](https://gitee.com/huge-dream/dvadmin-celery)
|
||||
- 升级中心后端:[dvadmin-upgrade-center](https://gitee.com/huge-dream/dvadmin-upgrade-center)
|
||||
- 升级中心前端:[dvadmin-upgrade-center-web](https://gitee.com/huge-dream/dvadmin-upgrade-center-web)
|
||||
|
||||
## 准备工作
|
||||
~~~
|
||||
Python >= 3.8.0 (推荐3.8+版本)
|
||||
nodejs >= 14.0 (推荐最新)
|
||||
Mysql >= 5.7.0 (可选,默认数据库sqlite3,推荐8.0版本)
|
||||
Redis(可选,最新版)
|
||||
~~~
|
||||
|
||||
## 前端♝
|
||||
|
||||
```bash
|
||||
# 克隆项目
|
||||
git clone https://gitee.com/liqianglog/django-vue-admin.git
|
||||
|
||||
# 进入项目目录
|
||||
cd web
|
||||
|
||||
# 安装依赖
|
||||
npm install --registry=https://registry.npm.taobao.org
|
||||
|
||||
# 启动服务
|
||||
npm run dev
|
||||
# 浏览器访问 http://localhost:8080
|
||||
# .env.development 文件中可配置启动端口等参数
|
||||
# 构建生产环境
|
||||
# npm run 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
|
||||
或使用 daphne :
|
||||
daphne -b 0.0.0.0 -p 8000 application.asgi:application
|
||||
~~~
|
||||
|
||||
### 访问项目
|
||||
|
||||
- 访问地址:[http://localhost:8080](http://localhost:8080) (默认为此地址,如有修改请按照配置文件)
|
||||
- 账号:`superadmin` 密码:`admin123456`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### docker-compose 运行
|
||||
|
||||
~~~shell
|
||||
# 先安装docker-compose (自行百度安装),执行此命令等待安装,如有使用celery插件请打开docker-compose.yml中celery 部分注释
|
||||
docker-compose up -d
|
||||
# 初始化后端数据(第一次执行即可)
|
||||
docker exec -ti dvadmin-django bash
|
||||
python manage.py makemigrations
|
||||
python manage.py migrate
|
||||
python manage.py init_area
|
||||
python manage.py init
|
||||
exit
|
||||
|
||||
前端地址:http://127.0.0.1:8080
|
||||
后端地址:http://127.0.0.1:8080/api
|
||||
# 在服务器上请把127.0.0.1 换成自己公网ip
|
||||
账号:superadmin 密码:admin123456
|
||||
|
||||
# docker-compose 停止
|
||||
docker-compose down
|
||||
# docker-compose 重启
|
||||
docker-compose restart
|
||||
# docker-compose 启动时重新进行 build
|
||||
docker-compose up -d --build
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
## 演示图✅
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
#### 特技
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
|
||||
21
backend/__init__.py
Normal file
21
backend/__init__.py
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
__title__ = ''
|
||||
__author__ = 'liqiang'
|
||||
__mtime__ = '2023/1/20'
|
||||
# code is far away from bugs with the god animal protecting
|
||||
I love animals. They taste delicious.
|
||||
┏┓ ┏┓
|
||||
┏┛┻━━━┛┻┓
|
||||
┃ ☃ ┃
|
||||
┃ ┳┛ ┗┳ ┃
|
||||
┃ ┻ ┃
|
||||
┗━┓ ┏━┛
|
||||
┃ ┗━━━┓
|
||||
┃ 神兽保佑 ┣┓
|
||||
┃ 永无BUG! ┏┛
|
||||
┗┓┓┏━┳┓┏┛
|
||||
┃┫┫ ┃┫┫
|
||||
┗┻┛ ┗┻┛
|
||||
"""
|
||||
121
docker-compose.yml
Normal file
121
docker-compose.yml
Normal file
@@ -0,0 +1,121 @@
|
||||
version: "3"
|
||||
services:
|
||||
dvadmin-web:
|
||||
container_name: dvadmin-web
|
||||
ports:
|
||||
- "8080:8080"
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./docker_env/web/Dockerfile
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- ./docker_env/nginx/my.conf:/etc/nginx/conf.d/my.conf
|
||||
expose:
|
||||
- "8080"
|
||||
networks:
|
||||
network:
|
||||
ipv4_address: 177.10.0.11
|
||||
|
||||
dvadmin-django:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./docker_env/django/Dockerfile
|
||||
container_name: dvadmin-django
|
||||
working_dir: /backend
|
||||
# 打开mysql 时,打开此选项
|
||||
# depends_on:
|
||||
# - dvadmin-mysql
|
||||
environment:
|
||||
PYTHONUNBUFFERED: 1
|
||||
DATABASE_HOST: dvadmin-mysql
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- ./backend:/backend
|
||||
- ./logs/log:/var/log
|
||||
ports:
|
||||
- "8000:8000"
|
||||
expose:
|
||||
- "8000"
|
||||
restart: always
|
||||
networks:
|
||||
network:
|
||||
ipv4_address: 177.10.0.12
|
||||
|
||||
# dvadmin-mysql:
|
||||
# image: mysql:5.7
|
||||
# container_name: dvadmin-mysql
|
||||
# #使用该参数,container内的root拥有真正的root权限,否则,container内的root只是外部的一个普通用户权限
|
||||
# #设置为true,不然数据卷可能挂载不了,启动不起
|
||||
## privileged: true
|
||||
# restart: always
|
||||
# ports:
|
||||
# - "3306:3306"
|
||||
# environment:
|
||||
# MYSQL_ROOT_PASSWORD: "123456"
|
||||
# MYSQL_DATABASE: "dvadmin_pro"
|
||||
# TZ: Asia/Shanghai
|
||||
# command:
|
||||
# --wait_timeout=31536000
|
||||
# --interactive_timeout=31536000
|
||||
# --max_connections=1000
|
||||
# --default-authentication-plugin=mysql_native_password
|
||||
# volumes:
|
||||
# - "./docker_env/mysql/data:/var/lib/mysql"
|
||||
# - "./docker_env/mysql/conf.d:/etc/mysql/conf.d"
|
||||
# - "./docker_env/mysql/logs:/logs"
|
||||
# networks:
|
||||
# network:
|
||||
# ipv4_address: 177.10.0.13
|
||||
|
||||
|
||||
# 如果使用celery 插件,请自行打开此注释
|
||||
# dvadmin-celery:
|
||||
# build:
|
||||
# context: .
|
||||
# dockerfile: ./docker_env/celery/Dockerfile
|
||||
# # image: django:2.2
|
||||
# container_name: dvadmin-celery
|
||||
# working_dir: /backend
|
||||
# depends_on:
|
||||
# - dvadmin-mysql
|
||||
# environment:
|
||||
# PYTHONUNBUFFERED: 1
|
||||
# DATABASE_HOST: dvadmin-mysql
|
||||
# TZ: Asia/Shanghai
|
||||
# volumes:
|
||||
# - ./backend:/backend
|
||||
# - ./logs/log:/var/log
|
||||
# restart: always
|
||||
# networks:
|
||||
# network:
|
||||
# ipv4_address: 177.10.0.14
|
||||
|
||||
|
||||
# dvadmin-redis:
|
||||
# image: redis:6.2.6-alpine # 指定服务镜像,最好是与之前下载的redis配置文件保持一致
|
||||
# container_name: dvadmin-redis # 容器名称
|
||||
# restart: on-failure # 重启方式
|
||||
# environment:
|
||||
# - TZ=Asia/Shanghai # 设置时区
|
||||
# volumes: # 配置数据卷
|
||||
# - ./docker_env/redis/data:/data
|
||||
# - ./docker_env/redis/redis.conf:/etc/redis/redis.conf
|
||||
# ports: # 映射端口
|
||||
# - "6379:6379"
|
||||
# sysctls: # 设置容器中的内核参数
|
||||
# - net.core.somaxconn=1024
|
||||
# command: /bin/sh -c "echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf && redis-server /etc/redis/redis.conf --appendonly yes" # 指定配置文件并开启持久化
|
||||
# privileged: true # 使用该参数,container内的root拥有真正的root权限。否则,container内的root只是外部的一个普通用户权限
|
||||
# networks:
|
||||
# network:
|
||||
# ipv4_address: 177.10.0.15
|
||||
|
||||
|
||||
networks:
|
||||
network:
|
||||
ipam:
|
||||
driver: default
|
||||
config:
|
||||
- subnet: '177.10.0.0/16'
|
||||
|
||||
65
docker_env/README.md
Normal file
65
docker_env/README.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# docker 镜像打包
|
||||
|
||||
### 打包web基础Build包
|
||||
|
||||
~~~sh
|
||||
# 编译打包到本地
|
||||
docker build -f ./docker_env/web/DockerfileBuild -t registry.cn-zhangjiakou.aliyuncs.com/dvadmin-pro/node14-base-web:latest .
|
||||
# 上传到阿里云仓库
|
||||
docker push registry.cn-zhangjiakou.aliyuncs.com/dvadmin-pro/node14-base-web:latest
|
||||
|
||||
~~~
|
||||
|
||||
### 打包Backend基础Build包
|
||||
|
||||
~~~sh
|
||||
# 编译打包到本地
|
||||
docker build -f ./docker_env/django/DockerfileBuild -t registry.cn-zhangjiakou.aliyuncs.com/dvadmin-pro/python310-base-backend:latest .
|
||||
# 上传到阿里云仓库
|
||||
docker push registry.cn-zhangjiakou.aliyuncs.com/dvadmin-pro/python310-base-backend:latest
|
||||
~~~
|
||||
|
||||
### 运行前端
|
||||
|
||||
~~~
|
||||
docker build -f ./docker_env/web/Dockerfile -t dvadmin-pro-web .
|
||||
~~~
|
||||
|
||||
### 运行后端
|
||||
|
||||
~~~
|
||||
docker build -f ./docker_env/django/Dockerfile -t dvadmin-pro-django .
|
||||
~~~
|
||||
|
||||
### 运行celery
|
||||
|
||||
~~~
|
||||
docker build -f ./docker_env/celery/Dockerfile -t dvadmin-pro-celery .
|
||||
~~~
|
||||
|
||||
## docker-compose 运行
|
||||
|
||||
~~~
|
||||
# 先安装docker-compose (自行百度安装),执行此命令等待安装,如有使用celery插件请打开docker-compose.yml中celery 部分注释
|
||||
docker-compose up -d
|
||||
# 初始化后端数据(第一次执行即可)
|
||||
docker exec -ti dvadmin-django bash
|
||||
python manage.py makemigrations
|
||||
python manage.py migrate
|
||||
python manage.py init -y
|
||||
exit
|
||||
|
||||
前端地址:http://127.0.0.1:8080
|
||||
后端地址:http://127.0.0.1:8000
|
||||
# 在服务器上请把127.0.0.1 换成自己公网ip
|
||||
账号:superadmin 密码:admin123456
|
||||
|
||||
# docker-compose 停止
|
||||
docker-compose down
|
||||
# docker-compose 重启
|
||||
docker-compose restart
|
||||
# docker-compose 启动时重新进行 build
|
||||
docker-compose up -d --build
|
||||
|
||||
~~~
|
||||
|
||||
7
docker_env/celery/Dockerfile
Normal file
7
docker_env/celery/Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
||||
FROM registry.cn-zhangjiakou.aliyuncs.com/dvadmin-pro/python38-base-backend:latest
|
||||
WORKDIR /backend
|
||||
COPY ./backend/ .
|
||||
RUN awk 'BEGIN { cmd="cp -i ./conf/env.example.py ./conf/env.py "; print "n" |cmd; }'
|
||||
RUN python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ -r requirements.txt
|
||||
CMD ["celery", "-A", "application", "worker", "-B", "--loglevel=info"]
|
||||
|
||||
6
docker_env/django/Dockerfile
Normal file
6
docker_env/django/Dockerfile
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM registry.cn-zhangjiakou.aliyuncs.com/dvadmin-pro/python310-base-backend:latest
|
||||
WORKDIR /backend
|
||||
COPY ./backend/ .
|
||||
RUN awk 'BEGIN { cmd="cp -i ./conf/env.example.py ./conf/env.py "; print "n" |cmd; }'
|
||||
RUN python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ -r requirements.txt
|
||||
CMD ["/backend/docker_start.sh"]
|
||||
8
docker_env/django/DockerfileBuild
Normal file
8
docker_env/django/DockerfileBuild
Normal file
@@ -0,0 +1,8 @@
|
||||
FROM python:3.10-alpine
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
RUN apk update && apk add bash bash-doc bash-completion git freetds-dev jpeg-dev linux-headers mysql-client mariadb-dev build-base libffi-dev openssl-dev zlib-dev bzip2-dev pcre-dev ncurses-dev readline-dev tk-dev postgresql-dev
|
||||
WORKDIR /backend
|
||||
COPY ./backend/requirements.txt .
|
||||
COPY ./docker_env/requirements-all.txt .
|
||||
RUN python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple/ -r /requirements.txt
|
||||
RUN python3 -m pip install -i https://mirrors.aliyun.com/pypi/simple/ -r /requirements-all.txt
|
||||
33
docker_env/mysql/conf.d/my.cnf
Normal file
33
docker_env/mysql/conf.d/my.cnf
Normal file
@@ -0,0 +1,33 @@
|
||||
[mysql]
|
||||
#设置mysql客户端默认字符集
|
||||
default-character-set=utf8
|
||||
socket=/var/run/mysql/mysql.sock
|
||||
|
||||
|
||||
[mysqld]
|
||||
# skip-grant-tables
|
||||
#mysql5.7以后的不兼容问题处理
|
||||
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
|
||||
datadir=/var/lib/mysql
|
||||
socket=/var/run/mysql/mysql.sock
|
||||
|
||||
# Disabling symbolic-links is recommended to prevent assorted security risks
|
||||
symbolic-links=0
|
||||
# Settings user and group are ignored when systemd is used.
|
||||
# If you need to run mysqld under a different user or group,
|
||||
# customize your systemd unit file for mariadb according to the
|
||||
# instructions in http://fedoraproject.org/wiki/Systemdd
|
||||
#允许最大连接数
|
||||
max_connections=1000
|
||||
#服务端使用的字符集默认为8比特编码的latin1字符集
|
||||
character-set-server=utf8
|
||||
#创建新表时将使用的默认存储引擎
|
||||
default-storage-engine=INNODB
|
||||
lower_case_table_names=1
|
||||
max_allowed_packet=16M
|
||||
#设置时区
|
||||
default-time_zone='+8:00'
|
||||
|
||||
[mysqld_safe]
|
||||
log-error=/var/log/mariadb/mariadb.log
|
||||
pid-file=/var/run/mariadb/mariadb.pid
|
||||
5
docker_env/mysql/launch.sh
Executable file
5
docker_env/mysql/launch.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
cur_path=`pwd`
|
||||
docker rm mysql
|
||||
# docker pull mysql:5.7
|
||||
# docker pull mysql:5.5
|
||||
docker run -p 3306:3306 --privileged=true --name mysql -v $cur_path/logs:/logs -v $cur_path/data:/var/lib/mysql -v $cur_path/conf.d/my.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf -v $cur_path/run/:/var/run/mysql -e MYSQL_ROOT_PASSWORD=q1w2e3r4 -d mysql:5.7
|
||||
33
docker_env/nginx/my.conf
Normal file
33
docker_env/nginx/my.conf
Normal file
@@ -0,0 +1,33 @@
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
client_max_body_size 100M;
|
||||
location / {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
set_real_ip_from 0.0.0.0/0;
|
||||
real_ip_header X-Forwarded-For;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.php index.htm;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Nginx-Proxy true;
|
||||
set_real_ip_from 0.0.0.0/0;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_connect_timeout 600s;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
real_ip_header X-Forwarded-For;
|
||||
rewrite ^/api/(.*)$ /$1 break; #重写
|
||||
proxy_pass http://177.8.0.12:8000/; # 设置代理服务器的协议和地址
|
||||
}
|
||||
}
|
||||
24
docker_env/redis/redis.conf
Normal file
24
docker_env/redis/redis.conf
Normal file
@@ -0,0 +1,24 @@
|
||||
### 指定redis绑定的主机地址,注释掉这部分,使redis可以外部访问
|
||||
# bind 127.0.0.1 -::1
|
||||
### 指定访问redis服务端的端口
|
||||
port 6379
|
||||
### 指定客户端连接redis服务器时,当闲置的时间为多少(如300)秒时关闭连接(0表示禁用)
|
||||
timeout 0
|
||||
### 默认情况下,Redis不作为守护进程运行。如果需要,请使用“yes”
|
||||
daemonize no
|
||||
### 给redis设置密码,不需要密码的话则注释
|
||||
# requirepass dvadmin
|
||||
### 开启redis持久化,默认为no
|
||||
appendonly yes
|
||||
### 防止出现远程主机强迫关闭了一个现有的连接的错误 默认是300
|
||||
tcp-keepalive 300
|
||||
### 指定redis数据库的日志级别,常用的日志级别有debug、verbose、notice、warning,不进行修改的情况下默认的是notice
|
||||
loglevel notice
|
||||
### 指定redis数据库多长时间内(s)有多少次(c)更新操作时就把缓存中的数据同步到本地库,比如:save 600 2,指的是10分钟内有2次更新操作,就同步到本地库
|
||||
save 600 2
|
||||
### 指定redis的最大内存。由于Redis 在启动时会把数据加载到内存中,当数据达到最大内存时,redis会自动把已经到期和即将到期的key值。所以可以根据需求调整自己的所需的最大内存
|
||||
maxmemory 500mb
|
||||
### 设置了maxmemory的选项,redis内存使用达到上限。可以通过设置LRU算法来删除部分key,释放空间。默认是按照过期时间的,如果set时候没有加上过期时间就会导致数据写满maxmemory
|
||||
maxmemory-policy volatile-lru
|
||||
### 设置外部网络连接redis服务,开启需配置bind ip或者设置访问密码,关闭此时外部网络可以直接访问
|
||||
# protected-mode yes
|
||||
9
docker_env/web/Dockerfile
Normal file
9
docker_env/web/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
||||
FROM registry.cn-zhangjiakou.aliyuncs.com/dvadmin-pro/node14-base-web:latest
|
||||
WORKDIR /web/
|
||||
COPY web/. .
|
||||
RUN npm install --registry=https://registry.npm.taobao.org
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:alpine
|
||||
COPY ./docker_env/nginx/my.conf /etc/nginx/conf.d/my.conf
|
||||
COPY --from=0 /web/dist /usr/share/nginx/html
|
||||
4
docker_env/web/DockerfileBuild
Normal file
4
docker_env/web/DockerfileBuild
Normal file
@@ -0,0 +1,4 @@
|
||||
FROM node:14-alpine
|
||||
WORKDIR /web/
|
||||
COPY ./web/package.json .
|
||||
RUN npm install --registry=https://registry.npm.taobao.org
|
||||
@@ -1,6 +1,7 @@
|
||||
import { CrudExpose, CrudOptions, AddReq, DelReq, EditReq, dict } from '@fast-crud/fast-crud';
|
||||
import _ from 'lodash-es';
|
||||
|
||||
import {h} from 'vue';
|
||||
import {tabBarProps} from "element-plus";
|
||||
interface CreateCrudOptionsTypes {
|
||||
crudOptions: CrudOptions;
|
||||
}
|
||||
@@ -169,7 +170,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
|
||||
col: { span: 24 },
|
||||
helper: {
|
||||
render() {
|
||||
return <el-tag type="warning">请正确填写,以免请求时被拦截。匹配单例使用正则,例如:/api/xx/.*?/</el-tag>
|
||||
return <el-tag>请正确填写,以免请求时被拦截。匹配单例使用正则,例如:/api/xx/.*?/</el-tag>
|
||||
},
|
||||
},
|
||||
component: {
|
||||
|
||||
@@ -73,18 +73,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
|
||||
delRequest,
|
||||
},
|
||||
rowHandle: {
|
||||
width: 330,
|
||||
buttons: {
|
||||
edit: {
|
||||
size: 'default'
|
||||
},
|
||||
view: {
|
||||
size: 'default'
|
||||
},
|
||||
remove: {
|
||||
size: 'default'
|
||||
}
|
||||
},
|
||||
buttons: {},
|
||||
},
|
||||
form: {
|
||||
col: { span: 24 },
|
||||
@@ -155,9 +144,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
|
||||
},
|
||||
form: {
|
||||
rules: [{ required: true, message: '权限标识必填' }],
|
||||
component: {
|
||||
placeholder: '输入权限标识',
|
||||
}
|
||||
placeholder: '输入权限标识',
|
||||
},
|
||||
},
|
||||
sort: {
|
||||
|
||||
@@ -1,26 +1,15 @@
|
||||
<template>
|
||||
<fs-page>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||||
<template #cell-rowHandle-right="scope">
|
||||
<el-button class="row-handle-btn" type="warning" size="default" @click="handleOpenRoleDrawer(scope.row.id, scope.row.name)"
|
||||
>权限管理</el-button
|
||||
>
|
||||
<template #cell_url="scope">
|
||||
<el-tag size="small">{{ scope.row.url }}</el-tag>
|
||||
</template>
|
||||
</fs-crud>
|
||||
<el-drawer v-model="state.roleVisible" direction="rtl" destroy-on-close size="65%">
|
||||
<template #header="{ close, titleId, titleClass }">
|
||||
当前角色
|
||||
<div>
|
||||
<el-tag size="default">{{ state.roleDrawerTitle }}</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
<span>Hi, there!</span>
|
||||
</el-drawer>
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useExpose, useCrud } from '@fast-crud/fast-crud';
|
||||
import { createCrudOptions } from './curd';
|
||||
|
||||
@@ -37,16 +26,6 @@ const { resetCrudOptions } = useCrud({ crudExpose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const state = reactive({
|
||||
roleVisible: false,
|
||||
roleDrawerTitle: '',
|
||||
});
|
||||
|
||||
const handleOpenRoleDrawer = (sign: string, title: string) => {
|
||||
state.roleDrawerTitle = title;
|
||||
state.roleVisible = true;
|
||||
};
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
crudExpose.doRefresh();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import { resolve } from 'path';
|
||||
import { defineConfig, loadEnv, ConfigEnv } from 'vite';
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx';
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||
const pathResolve = (dir: string): any => {
|
||||
return resolve(__dirname, '.', dir);
|
||||
};
|
||||
@@ -14,7 +14,7 @@ const alias: Record<string, string> = {
|
||||
const viteConfig = defineConfig((mode: ConfigEnv) => {
|
||||
const env = loadEnv(mode.mode, process.cwd());
|
||||
return {
|
||||
plugins: [vue(), vueJsx()],
|
||||
plugins: [vue(),vueJsx() ],
|
||||
root: process.cwd(),
|
||||
resolve: { alias },
|
||||
base: mode.command === 'serve' ? './' : env.VITE_PUBLIC_PATH,
|
||||
|
||||
Reference in New Issue
Block a user