Django-报错解决方法
无法使用Django新建项目:'django-admin.py’不是内部或外部命令
找到site-packages/django/bin(如 D:\Program Files\Anaconda3\Lib\site-packages\django\bin),把这个路径加入系统环境变量中。
error: unrecognized arguments: getall
原因:django版本和代码里的requirements.txt要求的不符
解决:重装django制定版本的代码
要用 pip 安装指定版本的 Python 包,只需通过 == 操作符 指定
pip install robotframework==2.8.7
将安装robotframework 2.8.7 版本。
‘WSGIRequest’ object has no attribute ‘user’
这是Django版本的问题,
1.9之前,中间件的key为MIDDLEWARE_CLASSES,
1.9之后,为MIDDLEWARE。
所以在开发环境和其他环境的版本不一致时,要特别小心,会有坑。需要在settings里面把MIDDLEWARE改为MIDDLEWARE_CLASSES 即可
TypeError at / ‘bool’ object is not callable
使用 Django自带的 auth 用户验证功能,编写函数,使用 is_authenticated 检查用户是否登录报错
def index(request, pid=None, del_pass=None):
if request.user.is_authenticated():
username = request.user.username
useremail = request.user.email
messages.get_messages(request)
template = get_template('index.html')
html = template.render(context=locals(), request=request)
return HttpResponse(html)
查询相关资料,发现 is_authenticated 是属性而不是方法,我们应该把括号去掉,这样就没什么问题了。
将 if request.user.is_authenticated(): 改为 if request.user.is_authenticated:
错误编码1050
python manage.py migrate myapp --fake # 数据库表结构同步成功
错误编码1146
1.同步数据库
项目建起来后,同步数据库,加入自定义的app
python manage.py syncdb
2.创建初始的迁移脚本
python manage.py makemigrations appname
3.同步迁移数据库
python manage.py migrate appname
user.User.basemodel_ptr: (fields.E300) Field defines a relation with model ‘BaseModel’, which is either not installed, or is abstract.

Django-报错解决方法的更多相关文章
- django.db.utils.InternalError: (1060, "Duplicate column name 'user_id'")迁移报错解决方法
django.db.utils.InternalError: (1060, "Duplicate column name 'user_id'")迁移报错解决方法 django.db ...
- eclipse创建的maven项目,pom.xml文件报错解决方法
[错误一:]maven 编译级别过低 [解决办法:] 使用 maven-compiler-plugin 将 maven 编译级别改为 jdk1.6 以上: <!-- java编译插件 --> ...
- MyEclipse Server view报错解决方法
MyEclipse Server view报错解决方法 方法/步骤 启动MyEclipse,弹出一个框,报错. ---------------------------------------- ...
- Loadrunner参数化逗号报错解决方法
Loadrunner参数化逗号报错解决方法 介绍Loadrunner参数化时,参数中包含有逗号时出错的解决方法. 在Loadrunner进行参数化时,参数中如果含有逗号,编辑保存后会报错: 此 ...
- Android Studio support 26.0.0-alpha1 Failed to resolve: com.android.support:appcompat-v7:27.+ 报错解决方法
AS下如何生成自定义的.jks签名文件, 以及如何生成数字签名 链接:http://www.cnblogs.com/smyhvae/p/4456420.html 链接:http://blog.csdn ...
- iOS url带中文下载时 报错解决方法
问题描述:下载文件时, 请求带中文的URL的资源时,比如:http://s237.sznews.com/pic/2010/11/23/e4fa5794926548ac953a8a525a23b6f2/ ...
- jquery jssdk分享报错解决方法
jssdk分享报错解决方法 一般都是参数传错了
- create-react-app创建项目后,运行npm run eject报错解决方法
运行npm run eject报错解决方法 主要问题是脚手架添加.gitgnore文件,但是却没有本地仓库,使用以下命令操作以下就可以了 git init git add . git commit - ...
- 打开struts-config.xml 报错 解决方法Could not open the editor
打开struts-config.xml 报错 解决办法Could not open the editor 错误信息:Could not open the editor: Project XXX is ...
- CitrixSmartAuditor安装报错解决方法
报错1:安装过程中报错 解决方法: SQLServer的配置: http://www.cnblogs.com/weizhengLoveMayDay/p/3267756.html 报错2:无法连接到Sm ...
随机推荐
- [JSOI 2008] 星球大战
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=1015 [算法] 考虑离线 , 将删点转化为加点 , 用并查集维护连通性即可 时间复杂 ...
- P3713 [BJOI2017]机动训练
这个题简直神仙,求相同路径的平方就等于两个人走相同路径的方案数.然后...暴力搜索+记忆化就行了,比较玄学. 题干: 题目描述 整个岛可以看作一片 n*m 的区域,每个格子有自己的地形. 一条路径由一 ...
- MSP430:实时时钟-DS1302
/* * DS1302.h * * Created on: 2013-11-27 * Author: Allen */ #ifndef DS1302_H_ #define DS1302_H_ #inc ...
- 【WIP】数据结构与算法入门
创建: 2017/12/25
- vue中子组件向父组件传值
1.子组件$emit()触发,父组件$on()监听 子组件:<template> <div class="hello"> <button v-on:c ...
- JavaScript编程艺术-第7章代码汇总(2)
[7.4节] 重回“JavaScript美术馆”代码 ***亲测可用*** HTML: JS:
- [C++ STL] 各容器简单介绍
什么是STL? 1.STL(Standard Template Library),即标准模板库,是一个高效的C++程序库. 2.包含了诸多常用的基本数据结构和基本算法.为广大C++程序员们提供了一个可 ...
- 洛谷 P3437 [POI2006]TET-Tetris 3D
二维线段树区间更新啊 树套树的外层树,如果是线段树的话一般似乎不能打标记?(毕竟标记不好下传) 然而起码对于这题是可以的...对于外层线段树,每个节点放两个内层线段树dat和setv,分别是得到的值和 ...
- DFS(连通块) HDU 1241 Oil Deposits
题目传送门 /* DFS:油田问题,一道经典的DFS求连通块.当初的难题,现在看上去不过如此啊 */ /************************************************ ...
- C#与正则表达式的例子
一个很好的文章,但是并没有测试 连接