记一次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 found. 1 pattern(s) tried: ['$index/$']
现象:
无论怎么修改views.py 还是urls.py,报错信息始终存在
问题发现:
项目目录结构如下
myweb
├── db.sqlite3
├── home
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── migrations
│ │ └── __init__.py
│ ├── models.py
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── manage.py
├── myweb
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ ├── wsgi.py
├── static
│ ├── images
│ │ ├── 55adde120001d34e00410041.png
│ │ ├── 55addf800001ff2e14410118.png
│ │ ├── 55addfcb000189b314410138.png
│ │ ├── background.jpg
│ │ ├── body_back.jpg
│ │ └── title.ico
│ └── jc
│ ├── 55ac9a860001a6c500000000.js
│ ├── 55ac9ea30001ace700000000.js
│ ├── jquery.easing.min.js
│ ├── jquery.fancybox.css
│ ├── sample-style.css
│ ├── scripts.js
│ ├── skin.css
└── templates
├── index.html
├── index_three.html
└── index_two.html
问题就出现在上面的两个urls.py中
在myweb的文件夹下的urls.py中,代码如下:
from django.conf.urls import url, include urlpatterns = [
url(r'^$', include('home.urls')),
]
在home的文件下的urls.py中,代码如下:
from django.conf.urls import url
from .views import HomeHtml urlpatterns = [
url(r'^$', HomeHtml().index, name='index'),
url(r'^index/$', HomeHtml().index_two, name='indextwo'),
url(r'^content/', HomeHtml().content, name='content'),
url(r'^showlist/', HomeHtml().showlist, name='showlist')
]
解决:
将规则改为如下,项目正常启动,无报错信息
from django.conf.urls import url, include urlpatterns = [
url(r'^', include('home.urls')),
]
记一次Django报错Reverse for 'indextwo' with no arguments not found. 1 pattern(s) tried: ['$index/$']的更多相关文章
- 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 '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. 我 ...
- 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 ...
- MRP进程起不来, 报错:ORA-00600: internal error code, arguments: [2619], [227424], [], [], [], [], [], [], [], [], [], []
问题背景:客户数据库服务架构为一主一备,某日备库操作系统意外重启,重启后Oracle MRP进程起不来,报错:ORA-00600: internal error code, arguments: [2 ...
- 记一次痛苦的Django报错调试经历:
开发的程序在我的本地mac上,ubuntu上,以及树莓派上都成功实现了迁移和运行,但是当准备将运行好好地程序迁移到阿里云的服务器上的mysql数据库上时,出现了非常多的幺蛾子的问题. 具体如下: 初始 ...
- ubuntu pip 安装django报错解决
系统版本 ubuntu Kylin 16.04 LTS 安装pip3 安装 Django 总是提示time out,无法安装. 逛了好多论坛终于遭到了解决办法,分享保存: sudo pi ...
- 关于Django报错django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configure
报错代码:django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but se ...
- django报错解决:view must be a callable or a list/tuple in the case of include().
django版本:1.11.15 django应用,修改urls.py后,访问报错:TypeError at /view must be a callable or a list/tuple in t ...
随机推荐
- SpringBoot RestFul风格API接口开发
本文介绍在使用springBoot如何进行Restful Api接口的开发及相关注解已经参数传递如何处理. 一.概念: REST全称是Representational State Transfer,中 ...
- 【python】*与**
1. 加了星号(*)的变量名会存放所有未命名的变量参数,不能存放dict,否则报错. 如: 1 def multiple(arg, *args): 2 print "arg: ", ...
- Python变量以及类型
变量的定义 在程序中,有时我们需要对2个数据进行求和,那么该怎样做呢? 大家类比一下现实生活中,比如去超市买东西,往往咱们需要一个菜篮子,用来进行存储物品,等到所有的物品都购买完成后,在收银台进行结账 ...
- Code::Blocks 导入Makefile工程
1)“File -> New -> Project”,选择“Empty Project”并创建. 2)选中 Project,右键,选择“Add files”,将 c/c++ 和 head ...
- 转的,具体 https://www.cnblogs.com/icyJ/p/FreeShare.html
网络资源下载网址 屏幕录像.图像处理,汉化和破解版本很新.国内破解汉化:大眼仔旭 http://www.dayanzai.me/ 开发工具,系统,数据库 http://msdn.itellyou.cn ...
- css变换与动画详解
举个栗子:--------元素整体居中.box{ position:absolute;top:50%;left:50%; width:50px; height:50px; t ...
- [C#]WinForm 中 comboBox控件之数据绑定
[C#]WinForm 中 comboBox控件之数据绑定 一.IList 现在我们直接创建一个List集合,然后绑定 IList<string> list = new List<s ...
- input输入完成后监听
clearTimeout(serachtimer); serachtimer=setTimeout(function(){ xxxxxxx //这里写处理的方法 },1000)
- android 开发 View _9_ 实现渐变功能(直线与圆形)
参考博客:https://blog.csdn.net/iispring/article/details/50500106/ android颜色渐变的分类有: LinearGradient线性渐变 线性 ...
- leetcode406
public class Solution { public int[,] ReconstructQueue(int[,] people) { ) { return new int[,] { }; } ...