在将Django升级到2.1后,运行 Django 自带后台后,或 使用 redirect 方法,就一直报错:Non-reversible reg-exp portion: '(?i'。

错误一

Django 2.X不再支持的URL正则写法:

url(r'(?i)^a/$', view.fun1)

url(r'^(?i)a/$', view.fun1)

应该改为:

url(r'^a/$(?i)', view.fun1)

同时也建议 Django2.+中,建议不要再使用 url,而改为 path 或 re_path。

--------------------------------------------------------------

错误二

使用 django.shortcuts.redirect 报错:Non-reversible reg-exp portion: '(?i':
使用 django.http.HttpResponseRedirect 来代替 django.shortcuts.redirect

【解决错误】Non-reversible reg-exp portion: '(?i'的更多相关文章

  1. 解决错误 Cannot await in the body of a catch clause

      解决错误 Cannot await in the body of a catch clause   static async Task f() { ExceptionDispatchInfo ca ...

  2. SQL 2012 发布与订阅实现数据同步 图解(解决 错误22022)

    概念参见:https://msdn.microsoft.com/zh-cn/library/ms151170.aspx 推送订阅 对于推送订阅,发布服务器将更改传播到订阅服务器,而无需订阅服务器发出请 ...

  3. Phonegap解决错误:Error initializing Cordova:Class not found

    Phonegap  解决错误: Alert [ERROR]Error initializing Cordova:Class not found 发现bug后找原因   网上说是  因为找不到     ...

  4. 轻松解决oracle11g 空表不能exp导出的问题

    轻松解决oracle11g 空表不能exp导出的问题 [引用 2012-9-22 18:06:36]     字号:大 中 小 oracle11g的新特性,数据条数是0时不分配segment,所以就不 ...

  5. Maximum execution time of 30 seconds exceeded解决错误方法

    Maximum execution time of 30 seconds exceeded解决错误方法Fatal error: Maximum execution time of 30 seconds ...

  6. 在vs2010中编译log4cxx-0.10.0详细方法(从下载、编译、解决错误详细介绍)

    在vs2010中编译log4cxx-0.10.0详细方法(从下载.编译.解决错误详细介绍) http://blog.sina.com.cn/s/blog_a459dcf501013tbn.html

  7. 【转】链接任意目录下库文件(解决错误“/usr/bin/ld: cannot find -lxxx”

    netbeans构建项目也出现了同样的问题.猜测是netbeans内部就用的是-l 这种编译方式,所以需要把***.a手动改为lib***.a 原文地址:链接任意目录下库文件(解决错误“/usr/bi ...

  8. 如何解决 错误code signing is required for product type 'xxxxx' in SDK 'iOS 8.2'

    如何解决 错误code signing is required for product type 'xxxxx' in SDK 'iOS 8.2' 大家在做真机调试的时候,或许会遇到这样的问题,那如何 ...

  9. python升级带来的yum异常(解决错误File "/usr/bin/yum", line 30 except KeyboardInterrupt, e:)

    解决错误File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: 错误: 原因: 这是因为yum采用python作为命令解 ...

  10. 如何解决错误【selenium.common.exceptions.SessionNotCreatedException】

    如何解决错误[selenium.common.exceptions.SessionNotCreatedException]   [问题起因] 2018年12月26日晚,启动我的pycharm准备学习s ...

随机推荐

  1. php foreach 的效率问题

    结果: 结论:多数情况下,循环时不带$k的foreach执行速度较快,建议没有使用到$k时,尽量不写

  2. IT兄弟连 Java语法教程 流程控制语句 循环结构语句2

    双重for循环 如果把一个循环放在另一个循环体中,那么就可以形成嵌套循环,也就是双重for循环,当然嵌套循环也可以是for循环嵌套while循环,也可以是while循环嵌套while循环……,即各种类 ...

  3. Generating a new SSH key

    Open Git Bash. Paste the text below, substituting in your GitHub email address. $ ssh-keygen -t rsa ...

  4. HDU - 6351 Beautiful Now

    Beautiful Now HDU - 6351 Anton has a positive integer n, however, it quite looks like a mess, so he ...

  5. hive on spark 常用配置

    常用设置 reset; set hive.execution.engine=spark; set hive.map.aggr = false; set hive.auto.convert.join = ...

  6. 【CF241E】Flights(差分约束)

    [CF241E]Flights(差分约束) 题面 CF 有\(n\)个点\(m\)条边,要求给每条边赋一个\(1\)或\(2\)的边权,判断能否使得每一条\(1\)到\(n\)的路径的权值和都相等,如 ...

  7. Idea导出jar包运行报错:找不到主清单属性解决方法

    解决方法 1.打开项目结构 2.创建一个Artifact 3.设置 我这里使用的maven,所以有resources文件夹 4.创建lib文件夹 右键output diretory,选择创建文件夹,名 ...

  8. vue-商品管理案例改进

    案例改进 vue-resource全局配置: Vue.http.options.root = 'http://vue.studyit.io/'; 全局启用 emulateJSON 选项 Vue.htt ...

  9. linux shell中$0,$?,$!等的特殊用法

    记录下linux shell下的特殊用法及参数的说明 变量说明: $$Shell本身的PID(ProcessID)$!Shell最后运行的后台Process的PID$?最后运行的命令的结束代码(返回值 ...

  10. 缓存cache(擦车)

    第一次接触到Cache的时候,是在WebForm中,第一次接触,我就再也没能忘记,cache(擦车,的拼音) 客户端浏览器缓存https://blog.csdn.net/y874961524/arti ...