五、Django学习之django3.0.3报错:Specifying a namespace in include() without providing an app_name

在根目录下的urls.py中使用了include方法,并且使用了namespace参数,如下图:

 url(r‘^my_app/‘, include((‘my_app.urls‘), namespace="my_app"))

在启动项目时,会报错:‘Specifying a namespace in include() without providing an app_name ‘

这是因为django2相对于django1做了改动,在include函数里增加了参数app_name,表示app的名字。

解决方法有两种:

1. 在include中传入该app的名字(第二个参数),即

url(r‘^my_app/‘, include((‘my_app.urls‘,‘my_app‘), namespace="my_app"))

2.在每一个app的urls.py文件中添加app_name变量,即

 url(r‘^my_app/‘, include((‘my_app.urls‘,app_name), namespace="my_app"))

原文地址:https://www.cnblogs.com/chushujin/p/12391150.html

时间: 2024-10-16 03:18:18

五、Django学习之django3.0.3报错:Specifying a namespace in include() without providing an app_name的相关文章

Django2.0异常:Specifying a namespace in include() without providing an app_name is not supported.

Django2.0异常:Specifying a namespace in include() without providing an app_name is not supported. 新建 模板 小书匠 欢迎使用 小书匠(xiaoshujiang)编辑器,您可以通过设置里的修改模板来改变新建文章的内容. Django2.0异常:Specifying a namespace in include() without providing an app_name is not supporte

CentOS7.0开机报错“piix4_smbus”和“dev fd0”的解决办法

系统:CentOS 7.0 X64 报错现象: 此问题包含了两个错误: 错误1: piix4_smbus host smbus controller not enabled 修改办法: [[email protected] ~]# lsmod | grep i2c i2c_piix4              22106  0  i2c_core               40325  2 drm,i2c_piix4 [[email protected] ~]# vi /etc/modprob

SQL Developer 4.0 启动报错“unable to create an instance of the java virtual machine located at path”

安装了Oracle之后,第一件事情就是想想怎么去连接,进而操作.SQL Developer是官方提供的强大工具,个人看来也是第一选择. 目前官网提供的最新版是4.0.1.14.48,下载下来之后,就跃跃欲试了.将下载下来的包解压,直接运行sqldeveloper.exe这个文件,选择了本地安装的JDK路径,之后却不幸的报错了,提示"unable to create an instance of the java virtual machine located at path",具体界面

RedHat5.5_X64 Linux安装oracle 11.2.0.3 报错

REDHAT linux 安装 11G  11.2.0.3   报错 oracle用户执行./runinstaller后 直接报错 查看日志后 [[email protected] OraInstall2012-06-29_12-08-50AM]# more installActions2012-06-29_12-08-50AM.log  SEVERE: [FATAL] HXZG: HXZG. Refer associated stacktrace #oracle.install.commons

关于web.xml3.0启动报错

九月 08, 2017 10:18:19 上午 org.apache.tomcat.util.digester.SetPropertiesRule begin 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:war_item' did not find a matching property. 九月 08, 20

AndroidStudio3.0 注解报错Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor.

体验最新版AndroidStudio3.0 Canary 8的时候,发现之前项目的butter knife报错,用到注解的应该都会报错 Error:Execution failed for task ':app:javaPreCompileDebug'. > Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to

mysql8.0+运行报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. 解决办法

话不多说,从错误即可知道是时区的错误,因此只要将时区设置为你当前系统时区即可, 因此使用root用户登录mysql,按照如下图所示操作即可. 我电脑的系统为北京时区,因此在系统中设置后,再连接数据库运行,一切OK! mysql8.0+运行报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. 解决办法 原文地址:https://www.cnblogs.co

学习React前端框架,报错 'React' must be in scope when using JSX react/react-in-jsx-scope

问题 import react from 'react'  改成  import React from 'react'   小写 react  改成 React 学习React前端框架,报错 'React' must be in scope when using JSX react/react-in-jsx-scope 原文地址:https://www.cnblogs.com/BensonHai/p/9952156.html

hivesql 迁移spark3.0 sparksql报错如Cannot safely cast '字段':StringType to IntegerType的问题

一 问题 hivesql可以正常运行,spark3.0运行报错如图 spark3.0配置 查看源码新增一个 val STORE_ASSIGNMENT_POLICY = buildConf("spark.sql.storeAssignmentPolicy") .doc("When inserting a value into a column with different data type, Spark will perform " + "type coe