`
skyfen
  • 浏览: 179945 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

django报错备份

阅读更多

报错:
1.local variable 'allreciver' referenced before assignment  .

   'allreciver' 变量无效

2.invalid literal for int() with base 10:
字段中用了int类型,说明有的字段不一致.需要调相关表字段的类型
也有可能提示的字段传过来的值是空的才报出这样的错误。

3.Attempted access to '/tmp/Cam000187.JPG' denied.

在后台管理中出错原因是:

  headshot = models.ImageField(upload_to='/tmp')
 去掉斜线"/"改成
  headshot = models.ImageField(upload_to='tmp')


4.'instancemethod' object is unsubscriptable'
Request Method: POST
Request URL: http://127.0.0.1:8000/vendor/insert
Exception Type: TypeError
Exception Value: 'instancemethod' object is unsubscriptable
Exception Location: D:\workspace\spaq\vendor\opvendor.py in save, line 22

第22行代码是:request.POST.get['vendorcode','']
应改成
request.POST.get('vendorcode','')

5.Exception Value: 'VENDORID' is an invalid keyword argument for this function

6.not enough arguments for format string


是字符串不充分,需要格式化

错误例子:

sql =  """               
                    select   
                         *                   from  
                        t_sale s , t_products p ,t_custom c
                  where
                        s.pr = p .proe  and s.w= c.licno
                        %s 
                        %s 
                        %s        
                       
                               
                 
                 
               """ %  ("" if self.cxt.request.user.is_superuser else " and manufactcode = '%s'" % self.cxt.request.user.organization_code,
                       " and  p.productsort_code = '%s'"%productsort_code if productsort_code else " ",
                       " and  p.productname like '%%%s%%' "%productname,
                                 
                       )
                      
 修改的地方是:" and  p.productname like '%%%s%%' "%productname,
 
 应改为:" and  p.productname like '%%%%%s%%%%' "%productname,多加两个%号
 
 6.ORA-00920: invalid relational operator
     无效的数据关联操作
 
 7. 'module' object has no attribute 'contact'
      module中没有contact这个对像 
 
  
8.ViewDoesNotExist at /
Could not import bbs.section. Error was: No module named util.pageRequest Method: GET
Request URL: http://127.0.0.1:8000/
Exception Type: ViewDoesNotExist

Exception Value: Could not import bbs.section. Error was: No module named util.page

util下有page文件的,但是就是报错

原因是util文件夹下的文件要以包形式在其它文件引用的话,util文件夹下必须包含__init__.py文件


MultiValueDictKeyError at /usrctrol/section/add/
"Key 'se_province_name' not found in <QueryDict: {}>"

 

9. Tried index in module mysite.form_contact. Error was: 'module' object has no attribute 'index'
 
 urls.py中配置的路径错误
 

分享到:
评论

相关推荐

    django连接mysql报错.docx

    ### Django 连接 MySQL 报错问题解析及解决方案 #### 问题背景 在启动Django项目时遇到连接MySQL数据库失败的问题,具体表现为`django.db.utils.OperationalError: (1045, "Access denied for user 'lenovo'@'...

    Django之创建引擎索引报错及解决详解

    ### Django之创建引擎索引报错及解决详解 在使用Django进行Web开发的过程中,可能会遇到各种各样的问题。本文将详细介绍在使用Django时创建搜索引擎索引时报错的情况及其解决方法。 #### 一、问题背景 在Django中...

    django迁移数据库错误问题解决

    在进行任何数据库操作之前,最好先备份数据库。同时,保持良好的版本控制习惯,可以避免很多不必要的麻烦。 总结来说,Django迁移错误通常涉及到依赖关系错误、模型改动冲突以及数据库表结构问题。通过理解错误信息...

    Django 中model的内容更改,所导致的一系列的报错的发生

    然而,如果之后你需要添加新的字段,并再次运行`migrate`,它会发现没有待应用的迁移,因此会报错“No migrations to apply.”。 在这种情况下,可以尝试以下步骤来解决: 1. **删除数据库中的表**:首先,你需要...

    django 在原有表格添加或删除字段的实例

    2. 如果你添加的是一个非可空字段(non-nullable field),并且没有为它提供默认值,Django会报错,因为它需要一个默认值来填充已有数据行。此时,你需要提供一个默认值,可以通过以下两种方式之一解决: - 提供一...

    图书管理系统

    **编码实现**阶段,开发者会利用编程语言(如Java、Python、C#等)和相关的框架(如Spring Boot、Django、ASP.NET等)来实现设计图中的功能。数据库操作通常通过ORM(对象关系映射)工具如Hibernate或MyBatis进行,...

    重新restore了mysql到另一台机器上后mysql 编码问题报错

    在进行MySQL数据库的迁移过程中,遇到一种常见的编码问题:将原有的MySQL数据库备份并恢复到另一台机器上后,在新开发的应用程序(如本例中的Django应用)中尝试添加包含中文字符的数据时,系统会报出错误提示。...

    yzyx.zip文件上传......

    "yzyx.zip" 文件上传的场景可能是用户在某个平台上传自己的数据或项目资源,以便于分享、备份或者进一步处理。在此,我们将深入探讨文件上传的相关知识点。 首先,我们需要了解文件上传的基本流程。当用户选择一个...

Global site tag (gtag.js) - Google Analytics