caoqianming / django-vue-admin Goto Github PK
View Code? Open in Web Editor NEW基于RBAC模型权限控制的中小型应用的基础开发平台,前后端分离,后端采用django+django-rest-framework,前端采用vue+ElementUI,移动端采用uniapp+uView(可发布h5和小程序).
License: MIT License
基于RBAC模型权限控制的中小型应用的基础开发平台,前后端分离,后端采用django+django-rest-framework,前端采用vue+ElementUI,移动端采用uniapp+uView(可发布h5和小程序).
License: MIT License
关于定时任务
使用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
我注册了任务,配置了周期性任务每分钟运行,但是就是没能成功运行,不知道是哪里的问题。
worker和beat都启动了,手动触发show就能执行。
能麻烦解答一下吗
感谢
我现在有个地方自己不会处理,就是菜单颜色,代码里是读取的variables.scss配置的颜色,我现在想改成在编译的时候通过我传入的参数设置颜色,我看element ui的菜单是有默认颜色和自定义颜色嘛,我现在就想有个这么的设置,比如我在.env.production里添加一个参数,在编译的时候通过这个参数判断是用默认的菜单颜色或者是自定义颜色,这个该怎么弄呢,scss这种我不太不会弄,我同一套代码想通过颜色区分开,部署了两个项目。
后端想得到当前登录的用户信息,需要怎么做呢。
前端http://localhost:9528
後端http://localhost:8000
頭像圖片預設圖取後端server/media內的資源
但無法正常顯示,
是不是要在前端路由中做修正?
作者你这个权限管理我有一点不清楚。在你的userviewset里面定义一个info,我该怎么做才能把info加到rbac里面呢?
# perms_map={'get':'*'}, 自定义action控权
@action(methods=['get'], detail=False, url_name='my_info', permission_classes=[IsAuthenticated])
def info(self, request, pk=None):
你的info加了一个permission,permission_classes=[IsAuthenticated]
,这一点我也很清楚。不过怎么加到rbac里面呢?
你把权限字典写在cache里面,但是更改权限时候并不是实时生效的(我自己测试是这个样子的),要不要加个信号保证cache里的数据实时更新呢?
如题,django的部分建议可以看情况打个包,方便pip install xxxx
的形式一键安装。
可能是django系最好看的后台了,但是不会js,不会vue,这部分就感觉很难堪,每次配置都这么麻烦的吗?
此项目特别有价值,请问简易的工作流模块 计划什么时候?
./src/styles/index.scss (./node_modules/_css-loader@1.0.1@css-loader??ref--8-oneOf-3-1!./node_modules/_postcss-loader@3.0.0@postcss-loader/src??ref--8-oneOf-3-2!./node_modules/_sass-loader@7.3.1@sass-loader/dist/cjs.js??ref--8-oneOf-3-3!./src/styles/index.scss)
Module build failed (from ./node_modules/_sass-loader@7.3.1@sass-loader/dist/cjs.js):
Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (93)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1
Error: PostCSS plugin autoprefixer requires PostCSS 8. Update PostCSS or downgrade this plugin.
allen@MacBook ~/dev/django-vue-admin/client master ± pnpm run dev
> [email protected] dev /Users/allen/dev/django-vue-admin/client
> set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve
INFO Starting development server...
10% building 2/2 modules 0 activeℹ 「wds」: Project is running at http://localhost:9528/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /Users/allen/dev/django-vue-admin/client/public
ℹ 「wds」: 404s will fallback to /index.html
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:68:19)
at Object.createHash (node:crypto:138:10)
at module.exports (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/util/createHash.js:90:53)
at NormalModule._initBuildHash (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/NormalModule.js:401:16)
at handleParseError (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/NormalModule.js:449:10)
at /Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/NormalModule.js:481:5
at /Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/NormalModule.js:342:12
at /Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
at /Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:236:3
at runSyncOrAsync (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
at iterateNormalLoaders (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
at Array.<anonymous> (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
at /Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
at /Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/graceful-fs/graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3)
10% building 2/5 modules 3 active ...r/client/index.js?http://localhost:9528node:internal/crypto/hash:68
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:68:19)
at Object.createHash (node:crypto:138:10)
at module.exports (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/util/createHash.js:90:53)
at NormalModule._initBuildHash (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/NormalModule.js:401:16)
at handleParseError (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/NormalModule.js:449:10)
at /Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/NormalModule.js:481:5
at /Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/NormalModule.js:342:12
at /Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at Array.<anonymous> (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
at /Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
at /Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]/node_modules/graceful-fs/graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
after run export NODE_OPTIONS=--openssl-legacy-provider
, there's a new error on npm run dev
:
Failed to compile.
./src/main.js
Module build failed (from ./node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/babel-loader/lib/index.js):
TypeError: this.getOptions is not a function
at Object.loader (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/babel-loader/lib/index.js:44:28)
at Object.<anonymous> (/Users/allen/dev/django-vue-admin/client/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/babel-loader/lib/index.js:39:12)
Traceback (most recent call last):
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\backends\utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\backends\mysql\base.py", line 74, in execute
return self.cursor.execute(query, args)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\MySQLdb\cursors.py", line 206, in execute
res = self._query(query)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\MySQLdb\cursors.py", line 319, in _query
db.query(q)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\MySQLdb\connections.py", line 259, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.ProgrammingError: (1146, "Table 'nspmdb.django_content_type' doesn't exist")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 21, in
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\core\management_init_.py", line 401, in execute_from_command_line
utility.execute()
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\core\management_init_.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\core\management\base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\core\management\base.py", line 369, in execute
output = self.handle(*args, **options)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\core\management\commands\loaddata.py", line 72, in handle
self.loaddata(fixture_labels)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\core\management\commands\loaddata.py", line 114, in loaddata
self.load_label(fixture_label)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\core\management\commands\loaddata.py", line 181, in load_label
obj.save(using=self.using)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\core\serializers\base.py", line 223, in save
models.Model.save_base(self.object, using=using, raw=True, **kwargs)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\models\base.py", line 784, in save_base
force_update, using, update_fields,
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\models\base.py", line 865, in _save_table
forced_update)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\models\base.py", line 917, in _do_update
return filtered._update(values) > 0
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\models\query.py", line 771, in _update
return query.get_compiler(self.db).execute_sql(CURSOR)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\models\sql\compiler.py", line 1500, in execute_sql
cursor = super().execute_sql(result_type)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\models\sql\compiler.py", line 1152, in execute_sql
cursor.execute(sql, params)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\backends\utils.py", line 100, in execute
return super().execute(sql, params)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\backends\utils.py", line 68, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\backends\utils.py", line 77, in _execute_with_wrappers
return executor(sql, params, many, context)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\backends\utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\utils.py", line 90, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\backends\utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\django\db\backends\mysql\base.py", line 74, in execute
return self.cursor.execute(query, args)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\MySQLdb\cursors.py", line 206, in execute
res = self._query(query)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\MySQLdb\cursors.py", line 319, in _query
db.query(q)
File "E:\pysource\django-vue-admin\server\venv\lib\site-packages\MySQLdb\connections.py", line 259, in query
_mysql.connection.query(self, query)
django.db.utils.ProgrammingError: Problem installing fixture 'E:\pysource\django-vue-admin\server\db.json': Could not load contenttypes.ContentType(pk=1): (1146, "Table 'nspmdb.django_content_type' doesn't exist")
(venv) E:\pysource\django-vue-admin\server>
没有报错信息
有人估计改了密码么
微信二维码过期了,能否更新一下
您好,已star,下载运行后发现,新增加用户时,不知道该用户的密码是多少 可否告知一下
if roles.depts.exists(): 这里是不是不能这样写?
如题:
model.objects.filter(is_deleted=True)是空的。这个该怎么查?
访问docs/时警告:
UserWarning: <class 'apps.system.views.UserViewSet'> is not compatible with schema generation
"{} is not compatible with schema generation".format(view.class)
这里需要处理吗?是什么原因?我搜了一下没找到解决方法,来请教一下
del
RT
permission.py文件
def has_permission(self, request, view):
"""
权限校验逻辑
:param request:
:param view:
:return:
"""
if not request.user:
perms = ['visitor'] # 如果没有经过认证,视为游客
else:
perms = cache.get(request.user.username + '__perms')
if not perms:
perms = get_permission_list(request.user)
if perms:
if 'admin' in perms:
return True
elif not hasattr(view, 'perms_map'):
return True
else:
perms_map = view.perms_map
_method = request._request.method.lower()
if perms_map:
for key in perms_map:
if key == _method or key == '*':
# 这里*号判断有问题
if perms_map[key] in perms or perms_map[key] == '*':
return True
return False
else:
return False
琢磨了三天了,求大佬解答😭
应当提示用户用户名和密码不正确。
头像无法加载
我看到其他项目也有,但不知道为什么,求解答~
能不能简单介绍一下系统添加菜单的方法,和使用,还有接口api
运行时说找不到index.html:django.template.exceptions.TemplateDoesNotExist: index.html
你好,你这个权限是不是没有完善?
我建立一个角色--测试角色,没有给测试角色打开/user/role的权限,但实测可以打开。
这个不能上传图片,,,,
如何部署到linux
大佬您好密码好像被更改了
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.