python3 manage.py makemigrations python3 manage.py migrate ##报错 改为##更改migrates的状态 python3 manage.py migrate --fake…
1. 在现有基础上又添加一个表的时候migrate报错 migrate报错django.db.utils.OperationalError: (1050, "Table 'cmdb_eidc' already exists") 解决1:python manage.py migrate --fake cmdb python manage.py migrate 如上没有解决:继续下面 python manage.py migrate --fake cmdb 0003 回退到0003号的mi…
自从mysql升级,以及使用mariaDB以来,很多不曾更新django中model的外键, 今天,按以前的思路写完外键之后, migrate命令报错: 1005 - Can't create table `xxxDB`.`#sql-1_407` (errno: 150 "Foreign key constraint is incorrectly formed") 很郁闷,跟踪到mysql的日志: SHOW ENGINE INNODB STATUS; -----------------…
前言 在讲解如何解决migrate报错原因前,我们先要了解migrate做了什么事情,migrate:将新生成的迁移脚本.映射到数据库中.创建新的表或者修改表的结构. 问题1:migrate怎么判断哪些迁移脚本需要执行? 它会将代码中的迁移脚本和数据库中django_migrations中的迁移脚本进行对比,如果发现数据库中,没有这个迁移脚本,那么就会执行这个迁移脚本. 问题2:migrate做了什么事情 将相关的迁移脚本翻译成SQL语句,在数据库中执行这个SQL语句. 如果这个SQL语句执行没…
Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set. django提交表单的时候报错 RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH s…
Django 执行迁移生成表: python manage.py migrate 报错: raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc) 原因: Django2.1不再支持MySQL5.5,必须5.6版本以上 解决办法: 二选一 (1)Django降级到2.0 pip install Django==2.0.0 -i https://pypi.douban.c…
今天项目开发中遇到一个错误,排查了很久才发现原因,现在分享出来,希望对大家有所帮助. 错误描述:在项目中添加了一个random.py的类,导入random中的choice,并在randstr方法中使用,运行randstr方法,报错: ImportError: cannot import name choice  查看import库的源文件,发现源文件存在且没有错误.后来经过一番搜索查询,发现是py文件的命名问题,random.py与源文件random名字相同,所以才会报错. 修改random.p…
SyntaxError at /blog/ news/story Non-ASCII character , but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details (views.py, line 42) 当使用中文时会报错: def introduce(req): return HttpResponse("<h1>ok你</h1>") 其解决方法是:在文件前面…
  PLSQL报错:"动态执行表不可访问,本会话的自动统计被禁止" CreationTime--2018年7月16日19点26分 Author:Marydon 1.情景展示 2.解决方案 设置-->选项-->取消勾选项"自动统计" 相关推荐: 类似文章  …
运行django项目报错:TypeError: object supporting the buffer API required 解决方案: 将settings.py中数据库的密码改成字符串格式 源码: def scramble_caching_sha2(password, nonce): # (bytes, bytes) -> bytes """Scramble algorithm used in cached_sha2_password fast path. XO…
RuntimeError at /login You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to 127.0.0.1:8009/login/ (note the tr…
这篇博客主要总结的学习Django框架中,遇到的报错如何去解决问题: 1.decimal.InvalidOperation: decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>] 在最后一行出现这样的报错: decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>] 这个报错其实是数据库的数据长度超过了原本的长度 在models中定义类型是Dec…
系统炸了导致不得已重装 安装 Django后 利用ORM 创建表的时候报错 Traceback (most recent call last): File "manage.py", line 17, in <module> "Couldn't import Django. Are you sure it's installed and " ImportError: Couldn't import Django. Are you sure it's ins…
Django版本号:1.11.15 django中ajax请求报错:You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. 将from的action地址改为/结尾的就可以了或者修改settings:APPEND_SLASH=Fa…
django程序的html页面中form的method='post'的时候报错 Forbidden (403) CSRF verification failed. Request aborted.Help Reason given for failure: CSRF token missing or incorrect. In general, this can occur when there is a genuine Cross Site Request Forgery, or when D…
1. 运行manage.py任务  makemigrations时,报错: doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. 解决:在全局setting.py的 INSTALLED_APPS中 添加 app的名字,如 2. 在添加一个生日字段 (日期类型)时报错: You are trying to add a non-nullable field 'email' to use…
1.原因:在进行 迁移文件生成时,程序并未给varchar类型字段设置 合适的长度,导致报错. 2.解决办法:找到database/ 目标迁移文件,修改其中类型为string的字段长度,建议不要超过255,否则报错 [然后再次运行php artisan migrate 即可成功] 示例: MySQL: ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes 今天测试遇到了这样的问题: MySQL> u…
记录自己在使用django开发过程中遇到的问题,不间断更新. (1) 独立运行普通Python脚本调用django中定义的类报错 报错信息: django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SE…
背景: 由于公司机房停电,jira服务器在停电期间需要关机处理,然而待重启启动服务时,jira出现报错,页面报错信息如下: Unable to clean the cache directory: /home/atlassian/data/jira/plugins/.osgi-plugins/felix caused by: Unable to delete file: /home/atlassian/data/jira/plugins/.osgi-plugins/felix/felix-cac…
pycharm 报错 cmd 报错 解决办法 首先 是计算机 编码问题  是 django 读取你的  用户host名 但是 windos 用户名 如果是中文 就会报这个错  要改成 英文…
今天一时手欠将电脑名字改成了中文,在启动Django或Flask项目的时候一直报下面的错误 问题描述: 环境配置成功,Django成功pip,运行项目报错,浏览器输入127.0.0.1:8000报错 问题截图: 问题所在:计算机名为中文 解决方法:更改计算机名为英文,重启电脑 重命名这台计算机 重新运行项目成功…
一.部署 Django 到远程 Linux 服务器 利用 xshell 通过 ssh 连接到 Linux服务器,常规的启动命令是 python3 manage.py runserver 但是,关闭 xshell 后,就访问不了 Django 了. 这时候需要使用 nohup 命令启动(概念:如果你正在运行一个进程,而且你觉得在退出帐户时该进程还不会结束,那么可以使用nohup命令.该命令可以在你退出帐户/关闭终端之后继续运行相应的进程) 这时输入 nohup python3 manage.py…
      最近做一个django项目,在设置了 DEBUG=False之后,访问接口,报错400.  何解???     查资料,得知:                                 400报错主要有两种: 1.bad request 意思是“错误的请求": 2.invalid hostname 意思是"不存在的域名”.     解决: settings.py文件中,设置ALLOW_HOSTS = ['*']…
今天是要Django3.5设置项目,结果出现中文报错,虽然之前分析过py2.7的报错原因,但是在py3之后reload不在使用,需要引入: from importlib import reload 但是这个并没有任何用,因为在py3之后默认编码不再是字节码,而是utf-8,可以使用代码查看 sys.getdefaultencoding() 这时候就出现了新的错误,出错地点 data = data.encode() AttributeError: 'bytes' object has no att…
 转自:https://segmentfault.com/a/1190000008416200 laravel运行命令migrate时报错: 1071 Specified key was too long; max key length is 1000 bytes (S   QL: alter table `users` add unique `users_email_unique`(`email`))   [PDOException]   SQLSTATE[42000]: Syntax err…
[oracle@localhost zgy]$ expdp orders/orders directory=DUMPDIR DUMPFILE=test_exp.dmp TRANSPORT_TABLESPACES= "(TEST30000,IDX_TEST30000)" LOGFILE=test_exp.logExport: Release 11.2.0.1.0 - Production on Fri Nov 27 18:00:20 2015Copyright (c) 1982, 200…
在配置django haystack时报错: 解决方案: 将ENGINE的值 改为 这样就可以了.…
背景:jdk1.8 + maven3.5.2 问题描述: 我在使用maven clean项目的时候,celan 失败,报错的原因是删除项目下的target文件夹下面的文件失败 解决方法: 打开任务管理器,把进程里面javaw.exe进程结束掉,然后再执行maven clean .问题得到解决…
记录下自己的错误 一. 1.原因是没有pdo扩展导致的, 2.解决办法:打开php.ini,然后去掉以下两行代码之前的分号(:)即可.如下: extension=php_pdo_firebird.dll extension=php_pdo_mysql.dll 二. 但是我运行pdo链接,还是报这个错.最后发现是自己的pdo链接字符串有问题,导致无法连接.原因是单引号与双引号的作用没有搞明白,单引号下的变量是php是不会去解析的,双引号与没有符号下的变量php才会去解析. 原文:https://b…
NO.1: You have 15 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.Run 'python manage.py migrate' to apply them. 解决:执行python manage.py migrate  同步更改数据库表或字段 NO.2:…