网址指向同一地址后:

Forbidden (403)

CSRF verification failed. Request aborted.

You are seeing this message because this site requires a CSRF cookie when submitting forms. This cookie is required for security reasons, to ensure that your browser is not being hijacked by third parties.

If you have configured your browser to disable cookies, please re-enable them, at least for this site, or for 'same-origin' requests.

解决方法:

在设置文件下注释:

'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
#'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',

新手报错

RuntimeError at /index
You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data.
Change your form to point to 127.0.0.1:8000/index/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.

解决方法,路由访问和提交要一致

片断

<form action="/index" method="post">

片断
path('index/',views.index)

安装xadmin时 编码出错:

"UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 3444"

解决方法,手工下载,xadmin

网上搜索了一下,说是 python3 不支持 xadmin,结果还是找到了解决的方法

从错误中可以看到,是文件README.rst 出现了 Unicode 解码错误,这个文件时没有什么用处的,可以新建一个同名的空白文件替换掉

然后安装:

C:\WINDOWS\system32>pip install xadmin-master.zip

搞定。。

继随用户表后    后台增加数据时  报错   问题三

1452,'无法添加或更新子行:外键约束失败(`mxonline` .django_admin_log`,CONSTRAINT`django_admin_log_user_id_c564eba6_fk_auth_user_id` FOREIGN KEY(`user_id`)REFERENCES` auth_user`(`id`))')

在设置数据配置那儿加入红色部份,,

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mxonline',
'USER': 'root',
'PASSWORD': '142857',
'HOST': '127.0.0.1',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
}
}

}

______________________________________________________________________________________________
git 无法下载东西,报错:
fatal: open /dev/null or dup failed: No such file or directory

C:\Windows\System32\drivers\null.sys 从其他系统上拷贝一个过来覆盖,再启动 null 服务就正常了:

如何确定null.sys是否正常,很简单。实行如下命令:

C:\Users\Administrator>sc start null

SERVICE_NAME: null
TYPE : 1 KERNEL_DRIVER
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
PID : 0
FLAGS :

链接:https://pan.baidu.com/s/1UtcZizm-iFcVk4OKrnFJVg 密码:1q4d

有一个更特么烦的报错可以让人自杀

在线安装xadmin时不响应,无反应,,,用下面的那个地址顺利解决


 pip install https://github.com/sshwsfc/xadmin/tarball/master 
 
 
问题:django使用验证码组件报错:django-simple-captcha 
build_attrs() takes from 1 to 2 positional arguments but 3 were given

解决方法,更新到最新版本即可

djanao报错:
Make sure you've included captcha.urls as explained in the INSTALLATION section on 
http://readthedocs.org/docs/django-simple-captcha/en/latest/usage.html#installation

解决方法:

url 视图增加相路由
path("captcha/", include('captcha.urls'))

问题之:
The view users.views.RegisterView didn't return an HttpResponse object. It returned None instead.

可能没有对应函数,检查vivew视图逻辑

问题:模板解释不了,原样输出
{% else %}  解决方法{%  不能有空格  

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

因为django2.0以上变化了好多,需要在分发的路由上面指定一下指定的是那个路由  示例代码:

主路由:

path("org/", include('organization.urls',namespace="org")),

分发路由:红色那儿是重点,指点引用的app 名字
urlpatterns = [
path("list/", OrgView.as_view(),name = "org_list"),

]
app_name = "organization"

  




django报错外理收集的更多相关文章

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

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

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

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

  5. ubuntu pip 安装django报错解决

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

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

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

  7. 记一次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 ...

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

  9. django报错解决:Invalid HTTP_HOST header: 'xxx.com'. You may need to add u'xxx.com' to ALLOWED_HOSTS.

    django版本:1.11.15 使用uwsgi+nginx运行django程序,出现报错,报错为:Invalid HTTP_HOST header: 'xxx.com:82'. You may ne ...

随机推荐

  1. 数据结构与算法-排序(六)堆排序(Heap Sort)

    摘要 堆排序需要用到一种数据结构,大顶堆.大顶堆是一种二叉树结构,本质是父节点的数大于它的左右子节点的数,左右子节点的大小顺序不限制,也就是根节点是最大的值. 这里就是不断的将大顶堆的根节点的元素和尾 ...

  2. .Net Core如何优雅的实现中间件

    在.Net Core的源码中,很多地方都有中间件的地方,Kestrel Server和Asp.net Core 等都用了中间件的设计,比如在Kestrel Server中,Http协议的1.0, 1. ...

  3. Python开发篇——基于React-Dropzone开发上传组件

    这次我要讲述的是在React-Flask框架上开发上传组件的技巧.我目前主要以React开发前端,在这个过程中认识到了许多有趣的前端UI框架--React-Bootstrap.Ant Design.M ...

  4. 在 CSS 中表示颜色的hex code方法和rgb方法

    hexadecimal code(十六进制编码),简写为 hex code. 我们通常使用 decimals,也就是十进制数字,它对每一位数字使用符号0到9来表示.Hexadecimals (或 he ...

  5. 数据结构与算法-排序(九)基数排序(Radix Sort)

    摘要 基数排序是进行整数序列的排序,它是将整数从个位开始,直到最大数的最后一位截止,每一个进位(比如个位.十位.百位)的数进行排序比较. 每个进位做的排序比较是用计数排序的方式处理,所以基数排序离不开 ...

  6. docker加速器,设置cdn

    添加加速器 vim /etc/docker/daemon.json 添加如下内容 { "registry-mirrors": ["https://registry.doc ...

  7. Centos7 安装 redis4.x

    一.安装redis 第一步:下载redis安装包 wget http://download.redis.io/releases/redis-4.0.6.tar.gz [root@iZwz991stxd ...

  8. 【转】关于DNS不得不说的一些事

    转自:https://www.cnblogs.com/rjzheng/p/11395695.html 引言 今天我们来聊聊DNS.所谓域名系统(Domain Name System缩写DNS,Doma ...

  9. 【springcloud】一文带你搞懂API网关

    作者:aCoder2013 https://github.com/aCoder2013/blog/issues/35 前言 假设你正在开发一个电商网站,那么这里会涉及到很多后端的微服务,比如会员.商品 ...

  10. 设计模式<一>

    设计原则1.找出应用中可能需要变化之处,把它们独立出来,不要和那些不需要变化的代码混在一起. 2.针对接口编程,而不是针对实现编程. 3.多用组合,少用继承. 一:策略模式,定义了算法族,分别封装起来 ...