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中配置的路径错误
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值