当前位置:网站首页>八阿哥纪事【四】
八阿哥纪事【四】
2022-04-22 06:29:00 【一只快乐的野指针D】
1.浏览器控制台报403错误,pycharm报错:Forbidden (CSRF cookie not set.): /login.html


解决方法:找到setting.py文件中的这一行,将其注释掉。

2.报错:AttributeError: 'QuerySet' object has no attribute 'uid'

原因:使用filter()方法从数据库得到的是一个QuerySet,不是User对象,没有uid属性
user = models.User.objects.filter(uid=uid)
if user:
if user.uid == uid and user.upwd == upwd:
res = {
"msg": "登陆成功",
"success": True
}
else:
res = {
"msg": "用户名或密码错误",
"success": False
}
解决方法:从QuerySet中获取具体的User对象即可。
3.报错:DoesNotExist: User matching query does not exist/
原因:没有在admin.py中注册所定义的model,查询时没有找到值时就报这个错误。
解决方法:定义完model后就去admin.py中注册。

版权声明
本文为[一只快乐的野指针D]所创,转载请带上原文链接,感谢
https://blog.csdn.net/sjhdxpz/article/details/120806495
边栏推荐
- Autoware显示用户界面细节
- .net core CefSharp ChromiumWebBrowser中网站JS调用winfrom程序中C#方法
- echars动态实现散点图并自定义信息提示框
- 专注数据安全,世平信息上榜中国网络安全行业全景图六大细分领域
- Raspberry pie 4B: USB mobile hard disk box startup (beta version)
- 树莓派Lite:安装discuz最新版
- Raspberry Pie 4: custom network time source
- Plain CSRF vulnerability
- STM32 peripherals [II] I2C
- RT thread [II] system initialization process
猜你喜欢

Application of Wireshark in traffic analysis

MNIST handwritten numeral recognition based on convolutional neural network lenet-5 model

【技术】西门子软PLC与组态软件如何通讯?

Misc novicate (Miscellaneous) notes

Continue raspberry pie 4B + OLED: automatically display the IP address after startup

培训赋能 | 打造专业技术服务团队

助力2021杭州市网络安全宣传周 | 世平信息精彩活动合集

在window环境下面virtualbox加载移动硬盘里创建好的虚拟机

Login interface - infiltrate you thousands of times

专注数据安全,世平信息上榜中国网络安全行业全景图六大细分领域
随机推荐
简单c语言练习:学生数据的存取
Login interface - infiltrate you thousands of times
Configuration list of raspberry pie (entry reference)
.net WebAPI访问授权机制及流程设计(header token+redis)
基于卷积神经网络LeNet-5模型的mnist手写数字识别
JWT realizes the whole process of login authentication, password encryption and token verification (with source code)
[TCP / IP V ICMP]
Xcode select: failed to locate 'PIP3', requesting installation
在window环境下面virtualbox加载移动硬盘里创建好的虚拟机
Raspberry Pie: access BitLocker to go encrypted disk
Autoware Demo测试
世平信息成功通过CMMI 3级认定
关于信息收集
. net5 log4net failed to log to the database after starting for a period of time
SuperSocket在.Net5中使用——启动篇
An alternative method of sending fixed format Chinese short message in Arduino: taking dht22 + GSM module as an example
C # made a simple raspberry pie IP search tool
Comparison of the differences between ArrayList and LinkedList
.net core CefSharp ChromiumWebBrowser中网站JS调用winfrom程序中C#方法
log4net在.Net Core使用
