Giter Site home page Giter Site logo

xskh2007 / django-vue-admin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from caoqianming/django-vue-admin

0.0 1.0 0.0 1.52 MB

基于RBAC模型权限控制的中小型应用的基础开发平台,前后端分离,后端采用django+django-rest-framework,前端采用vue+ElementUI,移动端采用uniapp+uView(可发布h5和小程序).

License: MIT License

JavaScript 16.33% HTML 0.14% Python 77.00% SCSS 1.38% CSS 5.15%

django-vue-admin's Introduction

简介

基于RBAC模型权限控制的中小型应用的基础开发平台,前后端分离,后端采用django+django-rest-framework,前端采用vue+ElementUI,移动端采用uniapp+uView(可发布h5和小程序).

JWT认证,可使用simple_history实现审计功能,支持swagger

内置模块有组织机构\用户\角色\岗位\数据字典\文件库\定时任务

支持功能权限(控权到每个接口)和简单的数据权限(全部、本级及以下、同级及以下、本人等)

部分截图

image image image

启动(以下是在windows下开发操作步骤)

django后端

定位到server文件夹

建立虚拟环境 python -m venv venv

激活虚拟环境 .\venv\scripts\activate

安装依赖包 pip install -r requirements.txt

修改数据库连接 server\settings_dev.py 导入测试数据 python manage.py loaddata db.json

或者直接使用sqlite数据库(超管账户密码均为admin)

同步数据库 python manage.py makemigrations system

同步数据库 python manage.py migrate

创建超级管理员 python manage.py createsuperuser

运行服务 python manage.py runserver 8000

vue前端

定位到client文件夹

安装node.js

安装依赖包 npm install --registry=https://registry.npm.taobao.org

运行服务 npm run dev

nginx

修改nginx.conf

listen 8012
location /media {
    proxy_pass http://localhost:8000;
}
location / {
    proxy_pass http://localhost:9528;
}

运行nginx.exe

运行

打开localhost:8012即可访问

接口文档 localhost:8000/docs

后台地址 localhost:8000/admin

理念

首先得会使用django-rest-framework, 理解vue-element-admin前端方案

本项目采用前端路由,后端根据用户角色读取用户权限代码返回给前端,由前端进行加载(核心代码是路由表中的perms属性以及checkpermission方法)

后端功能权限的核心代码在server/apps/system/permission.py下重写了has_permission方法

数据权限因为跟具体业务有关,简单定义了几个规则,重写了has_object_permission方法;根据需要使用即可

关于定时任务

使用celery以及django_celery_beat包实现

需要安装redis并在默认端口启动, 并启动worker以及beat

进入虚拟环境并启动worker: celery -A server worker -l info -P eventlet, linux系统不用加-P eventlet

进入虚拟环境并启动beat: celery -A server beat -l info

后续

考虑增加一个简易的工作流模块

django-vue-admin's People

Contributors

caoqianming avatar dependabot[bot] avatar github-user112 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.