Django 路由报错友好提示
这个方法要在设置路由文件内使用也就是urls.py内。
"""mysite URL Configuration The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
#导入整个自定义模块
from . import d2
urlpatterns = [
path('admin/', admin.site.urls),
]
# 统一捕获异常404
#handler400为要捕捉的错误提示这里拿404为例 = 项目名.模块名.方法名
handler404 = "mysite.d2.page_not_found"
因为Django内部设定若果你设置了捕捉错误提示,它就会认为你的项目以经上线,所以必须要在settings.py配置文件内把 DEBUG 改为False 才行。
Django 路由报错友好提示的更多相关文章
- 服务器重启报错:提示fstab readonly报错!( /etc/fstab 只读无法修改的解决办法)
摘自:http://blog.csdn.net/gray13/article/details/7432866 一.问题描述:服务器重启报错:提示fstab readonly报错! 二.问题原因:挂载的 ...
- python---补充django中文报错(1),Django2.7使用sys.setdefaultencoding('utf-8'),以及使用reload(sys)原因
SyntaxError at /blog/ news/story Non-ASCII character , but no encoding declared; see http://python.o ...
- Springboot项目启动报错,提示Cannot determine embedded database driver class for database type NONE
我在springboot项目里面引入了数据库的配置: <dependency> <groupId>org.mybatis.spring.boot</groupId> ...
- import cx_Oracle报错,提示importError: DLL load failed: 不是有效的Win32程序。
问题说明1:WIN32,python是2.7版本,本地oracle client是32位的.import cx_Oracle报错,提示importError: DLL load failed: 该模块 ...
- django运行报错TypeError: object supporting the buffer API required
运行django项目报错:TypeError: object supporting the buffer API required 解决方案: 将settings.py中数据库的密码改成字符串格式 源 ...
- YAML_06 playbook从上往下顺序执行,若报错,不提示,继续往下执行
ansible]# vim user4.yml --- - hosts: cache remote_user: root vars: user: bb tasks: - sh ...
- npm install 报错,提示`gyp ERR! stack Error: EACCES: permission denied` 解决方法
m install 报错,提示gyp ERR! stack Error: EACCES: permission denied 猜测可能是因为没有权限读写,ls -la看下文件权限设置情况 [root@ ...
- vue 项目报错,提示:Cannot read property '$createElement' of undefined at render ...
vue 项目报错,提示:Cannot read property '$createElement' of undefined at render ...
- Django独有报错的原因和解决
RuntimeError at /login You called this URL via POST, but the URL doesn't end in a slash and you have ...
随机推荐
- 腾讯机试题 AcWing 603 打怪兽
题目链接:https://www.acwing.com/problem/content/605/ 题目大意: 略 分析: 用dp[i][j]表示用j元钱能在前i只怪兽上所能贿赂到的最大武力值. 有一种 ...
- 关于@Param
1,使用@Param注解 当以下面的方式进行写SQL语句时: @Select("select column from table where userid = #{userid} " ...
- 当应用程序不是以UserInteractive 模式运行时显示模式对话框或窗体
最近在做一个WCF程序的时候,WCF程序老是弹出一个错误“当应用程序不是以UserInteractive 模式运行时显示模式对话框或窗体是无效操作.请指定ServiceNotification或Def ...
- volatile和synchronized的区别
volatile和synchronized特点 首先需要理解线程安全的两个方面:执行控制和内存可见. 执行控制的目的是控制代码执行(顺序)及是否可以并发执行. 内存可见控制的是线程执行结果在内存中对其 ...
- TP5系统变量输出
1.超全局变量 模板中: {$Think.sever.server_name} //全部小写,输出blog.cn 控制器: $_SERVER['SERVER_NAME'] ...
- jqprint控件使用
/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license //@ sourceMappingURL ...
- How to mount HFS EFI on macOS
mount_hfs /dev/disk0s1 /volumes/efi
- canvas图形绘制
前面的话 前面分别介绍了canvas的基础用法和进阶用法,本文将使用canvas的各种语法进行图形绘制 绘制线条 [绘制线条] 下面来尝试绘制一段线条 <canvas id="draw ...
- 吴恩达deeplearning之CNN—卷积神经网络
https://blog.csdn.net/ice_actor/article/details/78648780 个人理解: 卷积计算的过程其实是将原始的全连接换成了卷积全连接,每个kernel为对应 ...
- c++创建文件夹以及子文件夹
#ifdef WIN32 #include <io.h> #include <direct.h> #else #include <unistd.h> #includ ...