2020年12月11日
摘要: 使用 Django自带的 auth 用户验证功能,编写函数,使用 is_authenticated 检查用户是否登录,结果报错: TypeError at / 'bool' object is not callable 编写函数如下: 查询相关资料,发现 is_authenticated 是属性而不 阅读全文
posted @ 2020-12-11 13:34 锋齐叶落 阅读(5185) 评论(1) 推荐(1)
摘要: Django2.2 安装后,使用runserver进行开发,出错时错误信息只显示于控制台命令行,而在前端页面只显示一行 “A server error occurred. Please contact the administrator.” 排错很不方便,仔细查看控制台的错误信息,提示 Unicod 阅读全文
posted @ 2020-12-11 13:23 锋齐叶落 阅读(954) 评论(0) 推荐(1)
摘要: 错误日志 ERRORS: ?: (admin.E408) 'django.contrib.auth.middleware.AuthenticationMiddleware' must be in MIDDLEWARE in order to use the admin application. ?: 阅读全文
posted @ 2020-12-11 11:32 锋齐叶落 阅读(1103) 评论(0) 推荐(0)
摘要: primary_key表示unique = True.所以,正如警告所说,你可能应该使用OneToOneField 阅读全文
posted @ 2020-12-11 11:29 锋齐叶落 阅读(458) 评论(0) 推荐(0)
摘要: 对于 Python 2.X:import sysreload(sys)sys.setdefaultencoding("utf-8") 对于 <= Python 3.3:import impimp.reload(sys) 注意: 1. Python 3 与 Python 2 有很大的区别,其中Pyth 阅读全文
posted @ 2020-12-11 11:23 锋齐叶落 阅读(377) 评论(0) 推荐(0)
摘要: 换成django.urls 阅读全文
posted @ 2020-12-11 10:38 锋齐叶落 阅读(100) 评论(0) 推荐(0)
摘要: 使用pip install django-ckeditor安装 阅读全文
posted @ 2020-12-11 10:31 锋齐叶落 阅读(821) 评论(0) 推荐(0)