https://www.bilibili.com/video/BV1wT4y1j71A?p=2&spm_id_from=pageDriver
视频学习
1pycharm-terminal中pip
清华镜像:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple django
2继续-搭建网站
django-admin startproject mysite
运行之后,在现有目录下出现了一个文件夹mysite
3在terminal 中继续
python manage.py runserver
启动服务器,显示:Starting development server at http://127.0.0.1:8000/
4确保虚拟环境中有pymysql
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pymysql
在刚刚的端口号加admin,可以登录
创建超级管理员的账号
在ternimal中ctrl+c 退出
python manage.py createsuperuser
出现报错:
解决方案:
先输入:
python manage.py migrate
再输入:
python manage.py createsuperuser
然后回车
输入用户名,邮箱,密码
然后重启服务器 python manage.py runserver
打开端口到admin 输入账号密码可以成功登录
https://www.bilibili.com/video/BV1i54y1m7Wy?from=search&seid=15184868960535120652
1
Crm
- 权限组件 url=权限======>人-url
- stark组件(增删改查)
- crm业务
用户-权限------>角色-权限与角色-用户
RBAC role based on access control基于角色的访问控制
新增一个app
python manage.py startapp app_name
python manage.py startapp rbac
python manage.py startapp web
参考:https://www.jb51.net/article/168963.htm
参考:https://www.cnblogs.com/wupeiqi/ariticles/9178982.html
导入:luffy-permission(3)
运行出现问题
(1)
TypeError: init() missing 1 required positional argument: ‘on_delete’
解决方案:https://www.jianshu.com/p/b047438e4963
https://www.cnblogs.com/endurance9/p/8083747.html
(2)
ModuleNotFoundError: No module named ‘xlrd’
解决方案:直接pip install xlrd
(3)python manage.py migrate
(4)python manage.py createsuperuser
(5)python manage.py runserver
(6)得解决这些issues
rbac.Permission: (models.W042) Auto-created primary key used when not defining a primary key type, by default ‘django.db.models.AutoField’.
解决方案:https://zhuanlan.zhihu.com/p/368295349
(7)继续运行 python manage.py runserver
千万要记得关闭之前那个project窗口,不然两个project共用一个端口,hha所以难怪之前显示不出来呢—如下:它出现了!!!!(收工!