django-常见问题勘误

django-常见问题勘误,第1张

概述1.NoReverseMatch at / Reverse for 'about' not found. 'about' is not a valid view fun

1.noreverseMatch at / Reverse for 'about' not found. 'about' is not a valID vIEw function or pattern name.

这是因为自己指定了app_name,app_name='person'

在HTML界面中同样要指定,即<a href={% url '@H_404_8@person:index'%}>

2.You are trying to add a non-nullable fIEld 'name' to contact without a default

解决方法:
先给'name'任意初始值:name = models.CharFIEld(max_length=50,default='abc')
然后执行:python manage.py makemirations
再执行:python manage.py migrate


再将default删去,即执行:name = models.CharFIEld(max_length=50)
执行:python manage.py makemirations
再执行:python manage.py migrate

3.EmptyPage(在分页的时候会出现)

解决办法:

    try:        page=paginator.page(pn)    except EmptyPage:        page=paginator.page(1)

4.CSRF token missing or incorrect

将settings.py中的'django.mIDdleware.csrf.CsrfVIEwMIDdleware',注释掉

5.ConnectionAbortedError: [WinError 10053] 你的主机中的软件中止了一个已建立的连接。

在发送AJAX请求的时候设置:async : false,

 

 
总结

以上是内存溢出为你收集整理的django-常见问题勘误全部内容,希望文章能够帮你解决django-常见问题勘误所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1214383.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-05
下一篇2022-06-05

发表评论

登录后才能评论

评论列表(0条)

    保存