From 5e22ac37f579aa33505a776e2895d1519050d86e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BC=BA?= <1206709430@qq.com> Date: Fri, 26 Feb 2021 19:57:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE=E5=8F=8A?= =?UTF-8?q?=20README.md=20=E8=AF=B4=E6=98=8E=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 36 +++++++++++++------ dvadmin-backend/.gitignore | 4 +-- dvadmin-backend/application/settings.py | 4 ++- .../permission/migrations/__init__.py} | 0 .../system/migrations/__init__.py} | 0 .../conf/{env.py => env.example.py} | 14 ++------ dvadmin-backend/environment.py | 10 ------ dvadmin-ui/.env.development | 4 +++ 8 files changed, 37 insertions(+), 35 deletions(-) rename dvadmin-backend/{conf/prod.py => apps/permission/migrations/__init__.py} (100%) rename dvadmin-backend/{conf/sit.py => apps/system/migrations/__init__.py} (100%) rename dvadmin-backend/conf/{env.py => env.example.py} (83%) delete mode 100644 dvadmin-backend/environment.py diff --git a/README.md b/README.md index f597d1a..ebed079 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,20 @@ # Django-Vue-Admin -使用django+vue进行极速开发的全栈管理系统。 - [![img](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitee.com/liqianglog/django-vue-admin/blob/master/LICENSE) [![img](https://img.shields.io/pypi/v/django-simpleui.svg)](https://pypi.org/project/django-simpleui/#history) [![img](https://img.shields.io/badge/python-%3E=3.6.x-green.svg)](https://python.org/) ![PyPI - Django Version badge](https://img.shields.io/badge/django%20versions-2.2-blue)[![img](https://img.shields.io/pypi/dm/django-simpleui.svg)](https://pypi.org/project/django-simpleui/) +## 平台简介 + +Django-Vue-Admin 是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。 + +* 前端采用ruoyi-ui 、Vue、Element UI。 +* 后端采用Python语言Django框架。 +* 权限认证使用Jwt,支持多终端认证系统。 +* 支持加载动态权限菜单,多方式轻松权限控制。 +* ~~高效率开发,使用代码生成器可以一键生成前后端代码。~~ +* 特别鸣谢:[RuoYi](https://gitee.com/y_project/RuoYi-Vue) ,[Vue-Element-Admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://gitee.com/elunez/eladmin-web?_from=gitee_search),[Gin-Vue-Admin](https://www.gin-vue-admin.com/)。 + ## QQ群 - QQ群号:812482043 @@ -20,15 +29,6 @@ github地址:[https://gitee.com/liqianglog/django-vue-admin](https://gitee.com gitee地址:[https://github.com/liqianglog/django-vue-admin](https://github.com/liqianglog/django-vue-admin) -## 平台简介 - -* 前端采用ruoyi-ui 、Vue、Element UI。 -* 后端采用Python语言Django框架。 -* 权限认证使用Jwt,支持多终端认证系统。 -* 支持加载动态权限菜单,多方式轻松权限控制。 -* ~~高效率开发,使用代码生成器可以一键生成前后端代码。~~ -* 特别鸣谢:[RuoYi](https://gitee.com/y_project/RuoYi-Vue) ,[Vue-Element-Admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://gitee.com/elunez/eladmin-web?_from=gitee_search),[Gin-Vue-Admin](https://www.gin-vue-admin.com/)。 - ## 内置功能 1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。 @@ -73,6 +73,7 @@ npm install --registry=https://registry.npm.taobao.org npm run dev # 浏览器访问 http://localhost:8080 +# .env.development 文件中可配置启动端口等参数 ``` ### 发布 @@ -87,6 +88,19 @@ npm run build:prod ## 后端 +~~~bash +1. 进入项目目录 cd dvadmin-backend +2. 在项目根目录中,复制 env.example.py 文件为一份新的,并重命名为 env.py +3. 在 env.py 中配置数据库信息 +4. 执行迁移命令: + python3 manage.py makemigrations + python3 manage.py migrate +5. 创建 admin 用户 + python3 manage.py createsuperuser +6. 启动项目 + python3 manage.py runserver 0.0.0.0:8000 +~~~ + diff --git a/dvadmin-backend/.gitignore b/dvadmin-backend/.gitignore index 7b4c556..0bec1c6 100644 --- a/dvadmin-backend/.gitignore +++ b/dvadmin-backend/.gitignore @@ -89,7 +89,7 @@ ENV/ *.db .DS_Store __pycache__ -migrations/ +!migrations/__init__.py *.pyc -config.py +!conf/env.example.py db.sqlite3 diff --git a/dvadmin-backend/application/settings.py b/dvadmin-backend/application/settings.py index 1eaf059..6998da7 100644 --- a/dvadmin-backend/application/settings.py +++ b/dvadmin-backend/application/settings.py @@ -16,7 +16,7 @@ import os from mongoengine import connect -from environment import * +from conf.env import * # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -278,6 +278,8 @@ AUTHENTICATION_BACKENDS = ( 'utils.backends.SessionAuthentication', ) AUTH_USER_MODEL = 'permission.UserProfile' +# username_field +USERNAME_FIELD = 'username' # ================================================= # # ************** 登录验证码配置 ************** # diff --git a/dvadmin-backend/conf/prod.py b/dvadmin-backend/apps/permission/migrations/__init__.py similarity index 100% rename from dvadmin-backend/conf/prod.py rename to dvadmin-backend/apps/permission/migrations/__init__.py diff --git a/dvadmin-backend/conf/sit.py b/dvadmin-backend/apps/system/migrations/__init__.py similarity index 100% rename from dvadmin-backend/conf/sit.py rename to dvadmin-backend/apps/system/migrations/__init__.py diff --git a/dvadmin-backend/conf/env.py b/dvadmin-backend/conf/env.example.py similarity index 83% rename from dvadmin-backend/conf/env.py rename to dvadmin-backend/conf/env.example.py index 2e7376f..09d4d01 100644 --- a/dvadmin-backend/conf/env.py +++ b/dvadmin-backend/conf/env.example.py @@ -1,10 +1,4 @@ -""" -本地开发配置 -# 配置使用说明 -- 首先在backend下面新建config.py - eg: - environment_config = 'env' -""" + # ================================================= # # ************** mysql数据库 配置 ************** # # ================================================= # @@ -17,7 +11,7 @@ DATABASE_PORT = 3306 # 数据库用户名 DATABASE_USER = "root" # 数据库密码 -DATABASE_PASSWORD = "Aa428912." +DATABASE_PASSWORD = "123456" # 数据库名 DATABASE_NAME = "django-vue-admin" @@ -34,7 +28,7 @@ MONGO_PORT = 27017 REDIS_DB = 1 REDIS_HOST = '127.0.0.1' REDIS_PORT = 6379 -REDIS_PASSWORD = 'q1w2e3r4T%Y^U&I*2020' +REDIS_PASSWORD = '123456' # ================================================= # # ************** 默认配置 ************** # @@ -45,7 +39,5 @@ ALLOWED_HOSTS = ['*'] CORS_ORIGIN_ALLOW_ALL = True # 允许ajax请求携带cookie CORS_ALLOW_CREDENTIALS = False -# username_field -USERNAME_FIELD = 'username' # 验证码状态 CAPTCHA_STATE = True diff --git a/dvadmin-backend/environment.py b/dvadmin-backend/environment.py deleted file mode 100644 index f845224..0000000 --- a/dvadmin-backend/environment.py +++ /dev/null @@ -1,10 +0,0 @@ -from config import environment_config - - -if environment_config == 'sit': - from conf.sit import * -elif environment_config == 'prod': - from conf.prod import * -else : - from conf.env import * -print(f"导入[{environment_config}]配置成功!") diff --git a/dvadmin-ui/.env.development b/dvadmin-ui/.env.development index 52dbf84..9865866 100755 --- a/dvadmin-ui/.env.development +++ b/dvadmin-ui/.env.development @@ -6,5 +6,9 @@ VUE_APP_BASE_API = 'http://127.0.0.1:8000' # 路由懒加载 VUE_CLI_BABEL_TRANSPILE_MODULES = true + +# 前端端口 PORT=8080 + +# 首页标题 TITLE = 'dvAdmin管理系统'