- 博客(44)
- 问答 (1)
- 收藏
- 关注
原创 安装mysql-python pip3 install mysql-connector==2.1.7
安装不了mysql-python:使用terminalpip3 install mysql-connector==2.1.4
2019-03-14 21:59:18 1540
原创 mac mongodb : 715: /data/db/WiredTiger.turtle: handle-open: open: Permission denied
mongodb出现错误: 715: /data/db/WiredTiger.turtle: handle-open: open: Permission denied解决:sudo mongod新打开一个terminalcd /usr/local/mongodb/binexport PATH=/usr/local/mongodb/bin:$PATHmongo...
2019-08-23 20:54:34 1565
转载 RuntimeError: Model class user.models.UserAccount doesn't declare an explicit app_label
RuntimeError: Model class user.models.UserAccount doesn’t declare an explicit app_labelhttps://blog.csdn.net/qq_40321056/article/details/79979382
2019-04-28 18:01:41 1688
转载 django.db.utils.OperationalError: (1049, "Unknown database 'djangodb'")
django.db.utils.OperationalError: (1049, “Unknown database ‘djangodb’”)https://blog.csdn.net/zhangyu4863/article/details/82189753?utm_source=blogxgwz0
2019-04-28 18:00:58 3354
转载 ImportError: No module named httplib2 No module named 'import_export'
ImportError: No module named httplib2https://www.jianshu.com/p/30df0d1c7524
2019-04-28 17:59:04 2249
原创 ModuleNotFoundError: No module named 'django.contrib.formtools'
ModuleNotFoundError: No module named ‘django.contrib.formtools’ModuleNotFoundError: No module named ‘django.contrib.formtools’:将版本改成django-formtools==2.1
2019-04-28 17:58:16 2377
转载 mac下安装nginx
mac下安装nginxhttps://www.cnblogs.com/meng1314-shuai/p/8335140.html
2019-04-28 17:55:07 116
原创 (1054, "Unknown column 'goods_mygoods.image' in 'field list'")
(1054, “Unknown column ‘goods_mygoods.image’ in ‘field list’”)解决办法:加上default=""因为新加了image字段 ,数据库里之前的记录没有这个值image = models.ImageField(default="", upload_to=“images/%Y/%m”, verbose_name=u"图片", max_l...
2019-04-20 22:35:43 313
原创 Django “Cannot add or update a child row: a foreign key constraint fails”
Django “Cannot add or update a child row: a foreign key constraint fails”DATABASES = {‘default’: {…‘OPTIONS’: {“init_command”: “SET foreign_key_checks = 0;”,},}}
2019-04-20 22:34:53 603
原创 ERRORS: ?: (staticfiles.E002) The STATICFILES_DIRS setting should not contain the STATIC_ROOT settin
ERRORS: ?: (staticfiles.E002) The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting.错误原因有可能是在settings中静态文件目录设置的有问题STATIC_ROOT=os.path.join(BASE_DIR,“static/”)#错误STATIC_ROOT=os.pat...
2019-04-20 22:33:51 5233 1
原创 django.db.utils.InternalError: (1060, "Duplicate column name 'user_id'")
django.db.utils.InternalError: (1060, “Duplicate column name ‘user_id’”)一直出现这个问题,删除了migration文件里面的除了__int__.py文件继续执行,python manage.py migration如果还有问题python manage.py migrate --fake...
2019-04-20 22:33:03 2715
原创 django.db.migrations.loader.BadMigrationError: Migration 0001_initial in app employer has no Migrati
django.db.migrations.loader.BadMigrationError: Migration 0001_initial in app employer has no Migration class1、备份数据库2、把所有app的migrations目录全部清空(注意“清空”不是“删除”,要保留里面的__init__.py文件)3、重新运行makemigrations以及m...
2019-04-20 22:30:19 1267
原创 SMTPAuthenticationError: (535, '5.7.8 authentication failed')
SMTPAuthenticationError: (535, ‘5.7.8 authentication failed’)邮箱的STMP的服务没有开启,开启就好了
2019-04-20 22:29:32 3071 1
原创 django.db.utils.OperationalError: (1060, "Duplicate column name 'to_user_id'")
django.db.utils.OperationalError: (1060, “Duplicate column name ‘to_user_id’”)在project/app/migrations下有每次对数据操作所生成的脚本。找到出错那次脚本,打开脚本,将所对应的数据库更改还原(当然得使用mysql语句了)。然后删掉这次migration,重新make 然后执行。实在不行,还有一个万...
2019-04-20 22:26:39 5469
原创 AttributeError: 'str' object has no attribute 'decode'
AttributeError: ‘str’ object has no attribute ‘decode’错误源代码: class_list.append(folder.decode(‘utf-8’)) ;修改方法:把decode改为encode即可。
2019-04-20 22:25:11 3802
原创 xadmin出现No module named 'import_export'
xadmin出现No module named ‘import_export’pip install django-import-export
2019-04-20 22:24:21 590
原创 No module named 'django.core.urlresolvers'
django2.x报错No module named ‘django.core.urlresolvers’django2.0 把原来的 django.core.urlresolvers 包 更改为了 django.urls包,所以我们需要把导入的包都修改一下就可以了。https://blog.csdn.net/weixin_35757704/article/details/78977753...
2019-04-20 22:20:29 509
原创 ModuleNotFoundError: No module named 'future'
ModuleNotFoundError: No module named ‘future’pip install future
2019-04-20 22:18:19 7355
原创 No module named 'django.core.context_processors'
No module named ‘django.core.context_processors’找到django项目下的setting.py 修改改为原因是放context_processors的路径不一样。
2019-04-16 17:07:00 326
原创 DjangoUeditor ModuleNotFoundError: No module named 'widgets'
DjangoUeditor ModuleNotFoundError: No module named ‘widgets’github搜DjangoUeditor3,克隆到本地,复制文件夹里面的DjangoUeditor文件夹,放到虚拟环境下的lib/site-packages/下...
2019-04-16 17:05:19 1455 1
原创 view didn't return an HttpResponse object
“view didn’t return an HttpResponse object.”检查views中最后有没有返回值,可能是return错位了。
2019-04-16 17:03:27 1556
原创 Error: That port is already in use
Django 运行 端口被占用 Error: That port is already in use本来运行项目:python manage.py runserver 8000发现运行到结果报错:Error: That port is already in use首先查看已存在端口号列表: $ ps aux | grep -i manage然后只需运行$ kill -9 <pid&g...
2019-04-16 17:02:45 2137
原创 django 下拉菜单显示为object的解决办法
django 下拉菜单显示为object的解决办法但时候有下拉框选项(只要在model中有定义Charfield就会显示为下拉框),如果遇到了如下情况我使用的python版本为3.6,可以看到list_display使用的是__str__方法,但是我在我的models中所有的返回值都是Unicode(其实python3自动进行了兼容处理,,看到那个装饰器了吗?会将str转为unicode),猜...
2019-04-16 16:59:36 1409
原创 ModuleNotFoundError: No module named 'XXX'
python程序在命令行执行提示ModuleNotFoundError: No module named ‘XXX’在ide中执行python程序,都已经在默认的项目路径中,所以直接执行是没有问题的。但是在cmd中执行程序,所在路径是python的搜索路径,如果涉及到import引用就会报类似ImportError: No module named xxx这样的错误,解决方法:在报错的模块中...
2019-04-16 16:55:41 1841
原创 IndentationError: unindent does not match any outer indentation level
IndentationError: unindent does not match any outer indentation level具体来说是由于有的地方使用了4个空格,有的地方使用了tab键。代码区直接全选就会看到有的地方是四个点有个地方是一个横线,改一致了就好了。...
2019-04-16 16:53:20 2771
原创 django.template.exceptions.TemplateDoesNotExist: index.html
Django 找不到模版报错" django.template.exceptions.TemplateDoesNotExist: index.html"解决办法:在setting.py的TEMPLATES‘DIRS'[]加入模版路径<span style="font-size: 15px; color: #ff0000;">os.path.join(BASE_DIR, 'temp...
2019-04-16 16:50:25 2893 1
原创 ImportError: No module named crispy-forms
ImportError: No module named crispy-formspip3 install --user django-crispy-formsYou have to make sure that you install crispy-forms into the virtualenv.Activate VirtualEnv (where env is the direc...
2019-04-16 16:48:53 373
原创 django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11搭建Django2.0+Python3+MySQL5时同步数据库时报错:django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3...
2019-04-16 16:46:24 1039
原创 AttributeError: module 'sys' has no attribute 'setdefaultencoding
Python3异常-AttributeError: module 'sys' has no attribute 'setdefaultencoding基于python3.6.1版本,在一个.py文件中,加入这3行:import requests, re, sysreload(sys)sys.setdefaultencoding("utf-8") 出现这样的错误:sys.setde...
2019-04-16 16:44:22 19958 2
原创 NameError: name 'reload' is not defined
NameError: name 'reload' is not defined在 python2 中,reload() 是内置函数,但到了 python3 中,就没有了这个内置函数了,得另外导入from imp import reload
2019-04-16 16:43:09 206
原创 1452, 'Cannot add or update a child row: a foreign key constraint fails
Django后台添加用户报错:1452, 'Cannot add or update a child row: a foreign key constraint failsdjango.db.utils.IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`mxonl...
2019-04-16 16:42:07 1039
原创 ModuleNotFoundError: No module named 'ConfigParser'
python3 pip install mysql-pythonModuleNotFoundError: No module named 'ConfigParser'MySQLdb不支持python3,网上不少人推荐PyMySQL解决安装pymql:pip install pymysqldjango项目__inti__.py中添加以下代码import pymysqlpym...
2019-04-16 16:41:02 686
翻译 linux
[root@study ~]# cd /tmp <==切換工作目錄到/tmp[root@study tmp]# mkdir testing <==建立新目錄[root@study tmp]# chmod 744 testing <==變更權限[root@study tmp]# touch tes...
2019-04-11 17:10:48 74
原创 mac:"-bash: mysql: command not found"
输入命令$ ln -s /usr/local/mysql/bin/mysql /usr/bin如果出现错误ln: /usr/bin/mysql: Operation not permitted输入$ sudo ln -s /usr/local/mysql/bin/mysql /usr/bin然后输入你的密码如果出现错误ln: /usr/bin/mysql...
2019-04-11 10:59:23 1329
原创 django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not
在shell窗口输入 import viewclass.models as models 来引入模块,结果报错:django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the env...
2019-04-11 10:54:03 1601
原创 django.db.utils.OperationalError: no such table
django.db.utils.OperationalError: no such table.可以用python manage.py makemigrations以及 python manage.py migrate来解决…有时即使这样做了,还是提示报错.在你数据库中有一个`django_migrations数据表`,这里存储了你之前很多的信息,||找到你...
2019-04-11 10:49:21 2728
原创 TypeError: __init__() missing 1 required positional argument: 'on_delete'
运行python manage.py makemigrations出现错误`TypeError: __init__() missing 1 required positional argument: 'on_delete'`在外键值的后面加上 on_delete=models.CASCADE herobook=models.ForeignKey('BookInfo',on_delet...
2019-04-11 10:44:03 904
原创 django.template.exceptions.TemplateDoesNotExist
TemplateDoesNotExist看了一个帖子说的是templates 文件夹要和项目以及app同级别 ,我一看我的templates 文件夹在APP文件夹里面,于是果断吧templates 拉出来,
2019-04-11 10:39:26 1655
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人