Django 报错 Reverse for 'content' not found. 'content' is not a valid view function or pattern name.
Django 报错 Reverse for 'content' not found. 'content' is not a valid view function or pattern name.

- 我这边的原因是由于命名空间的错误导致的bug
from django.urls import path
from . import views
app_name = 'energy' # 给app命名空间
urlpatterns = [
path('search/', views.search, name='search'), # 给视图函数分配命名空间
path('content/', views.content, name='content')
]
- 这样下面就可以使用了!
<form action="{% url 'energy:content' %}" method="POST">
{% csrf_token %}
<div>
<label>
<input type="text" name="搜索内容">
</label>
<input type="submit" value="搜索">
</div>
</form>
Django 报错 Reverse for 'content' not found. 'content' is not a valid view function or pattern name.的更多相关文章
- django 报错Reverse for 'detail' with keyword arguments '{'pk': '2'}' not found. 1 pattern(s) tried: ['$post/(?P<pk>[0-9]+)/$']
Django报错:Reverse for 'detail' with keyword arguments '{'pk': '2'}' not found. 1 pattern(s) tried: [' ...
- 记一次Django报错Reverse for 'indextwo' with no arguments not found. 1 pattern(s) tried: ['$index/$']
启动python manage.py runserver 打开127.0.0.1:8000,报错信息如下: Reverse for 'indextwo' with no arguments not f ...
- Django报错:OSError: raw write() returned invalid length 4 (should have been between 0 and 2)
在使用Django时Django报错:Django报错:OSError: raw write() returned invalid length 4 (should have been between ...
- 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 ...
- 关于报错:'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based
最近在看Extension相关知识的时候,自己写了个小demo 发现[UIApplication sharedApplication]这个方法敲不出来了, 总是报错:'sharedApplicatio ...
- 记录微信小程序报错 Unexpected end of JSON input;at pages/flow/checkout page getOrderData function
微信小程序报错 Unexpected end of JSON input;at pages/flow/checkout page getOrderData function 这个报错是在将数组对象通过 ...
- DevOps 创建pipline报错:The value specified for SourceVersion is not a valid commit ID
报错内容 The value specified for SourceVersion is not a valid commit ID 解决 官方给出的解答: Thank you for your f ...
- ubuntu pip 安装django报错解决
系统版本 ubuntu Kylin 16.04 LTS 安装pip3 安装 Django 总是提示time out,无法安装. 逛了好多论坛终于遭到了解决办法,分享保存: sudo pi ...
- web.xml文件报错:cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param'.
<?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" ...
随机推荐
- E - E(最短路解决源点到多点,多点到源点的和(有向图))
问从1号点到各个点的距离+各个点到1号点之间的距离和的最小值 详解键连接https://www.cnblogs.com/csx-zzh/p/13411588.html In the age of te ...
- codeforces626D . Jerry's Protest (概率)
Andrew and Jerry are playing a game with Harry as the scorekeeper. The game consists of three rounds ...
- 前、中、后序遍历随意两种是否能确定一个二叉树?理由? && 栈和队列的特点和区别
前序和后序不能确定二叉树理由:前序和后序在本质上都是将父节点与子结点进行分离,但并没有指明左子树和右子树的能力,因此得到这两个序列只能明确父子关系,而不能确定一个二叉树. 由二叉树的中序和前序遍历序列 ...
- service配置文件
[Unit]Description="itcp Service"After=network.target cs_tcp.service [Service]Type=simpleGu ...
- Redis全面解析
1.什么是Redis? Redis是BSD协议,是一个高性能的key-value非关系型数据库. 2.redis单线程问题 所谓的单线程指的是网络请求模块使用了一个线程(所以不需考虑并发安全性),即一 ...
- VS2010的单元测试(二)
四.附加测试属性 附加测试属性,在默认生成的测试代码是使被注释掉的,取消注释就可以使用. 例如,要在执行测试前,输出测试开始时间,在执行测试后,输出测试结束时间.代码如下: [ClassInitial ...
- Unknown command '\b'. 关于Mysql导入外部数据库脚本报错的解决
来自网络转载 还是字符集的问题 使用source导入外部sql文件: mysql> source F:\php\bookorama.sql;--------------source F:---- ...
- 强网杯 2019]随便注(堆叠注入,Prepare、execute、deallocate)
然后就是今天学的新东西了,堆叠注入. 1';show databases; # 1';show tables; # 发现两个表1919810931114514.words 依次查询两张表的字段 1'; ...
- sql-libs(2) 数字型
经测试,发现是数字型的注入,直接 and 1=1 返回正常,and1=2返回错误,感觉比第一关更加简单一点啊,,透~ 经测试order by 为 3 . 1. union 注入 http://192. ...
- npm config set registry
npm config set registry $ npm config set registry $ npm config set registry https://registry.your-re ...