启动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/$']的更多相关文章

  1. 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: [' ...

  2. 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. 我 ...

  3. 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 ...

  4. 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 ...

  5. MRP进程起不来, 报错:ORA-00600: internal error code, arguments: [2619], [227424], [], [], [], [], [], [], [], [], [], []

    问题背景:客户数据库服务架构为一主一备,某日备库操作系统意外重启,重启后Oracle MRP进程起不来,报错:ORA-00600: internal error code, arguments: [2 ...

  6. 记一次痛苦的Django报错调试经历:

    开发的程序在我的本地mac上,ubuntu上,以及树莓派上都成功实现了迁移和运行,但是当准备将运行好好地程序迁移到阿里云的服务器上的mysql数据库上时,出现了非常多的幺蛾子的问题. 具体如下: 初始 ...

  7. ubuntu pip 安装django报错解决

    系统版本 ubuntu  Kylin 16.04 LTS       安装pip3 安装 Django 总是提示time out,无法安装. 逛了好多论坛终于遭到了解决办法,分享保存: sudo pi ...

  8. 关于Django报错django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configure

    报错代码:django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but se ...

  9. 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 ...

随机推荐

  1. golang web framework--Martini

    Martini是一个功能强大的软件包,用于在Golang中快速编写模块化Web应用程序/服务. 下载 $ go get github.com/go-martini/martini Demo serve ...

  2. <realsense D400>同步采集深度图和彩色图

    利用深度相机采集深度图和彩色图会面临一个问题,如何实现同步采集数据? 以下是我搜集到的两点方法: 1)高翔博士提到他的orbslam2教程有这么一步工作,具体目录为 example/RGBD/. (等 ...

  3. SAX解析与DOM解析

    SAX解析实例:http://www.iteye.com/topic/763895 Java Sax解析是按照xml文件的顺序一步一步的来解析,在解析xml文件之前,我们要先了解xml文件的节点的种类 ...

  4. SpringBoot配置(2) slf4j&logback

    SpringBoot配置(2) slf4j&logback 一.SpringBoot的日志使用 全局常规设置(格式.路径.级别) SpringBoot能自动适配所有的日志,而且底层使用slf4 ...

  5. node升级的正确方法

    本文主要是针对安装了node的用户如何对node进行升级或者安装指定版本:没有安装node的可以参考连接node安装方法 . 安装方法: 1.产看node版本,没安装的请先安装: $  node -v ...

  6. Ubuntu 14.10 下安装Ambari 问题汇总

    在编译安装Ambari时候遇到了很多问题,现在记录一下 1 got error npm ERR! phantomjs@1.9.12 install while building ambari-web ...

  7. Schtasks命令详解(计划任务DOS批处理)

    Schtasks 安排命令和程序定期运行或在指定时间内运行.从计划表中添加和删除任务,按需要启动和停止任务,显示和更改计划任务. 创建新的计划任务. 语法 schtasks/create/tnTask ...

  8. mysql 拒绝登录解决

    一大早打开Navicat Lite for MySQL客户端,提示1045 access denied for user ’root’@’localhost’ using password yes,太 ...

  9. vue+窗格切换+田字+dicom显示_01

    环境:vue+webpack+cornerstone ide:vs code 需求:窗格设置+拼图设置 1.点击左边第一个窗格或者默认显示. 2.点击第二个也同理显示,以此类推 3.选择左边的窗格之后 ...

  10. PyQt5系列教程(六)如何让界面和逻辑分离

    软硬件环境 OS X EI Capitan Python 3.5.1 PyQt 5.5.1 PyCharm 5.0.3 前言 前面的内容我们介绍了利用QtDesigner来设计界面,再通过命令行工具p ...