django 不会正常报错了

2018-05-09 17:44:11 +08:00
 fankcoder

所有的错误统一都返回 "in exception"

比如我在 views.py 里随便乱写一行也是返回 in exception

正常例子: def test(request): ret = {'test':1} return HttpResponse(json.dumps(ret), content_type="application/json")

返回 in exception 例子: def test(request): asdfasdb #乱写的错误 ret = {'test':1} return HttpResponse(json.dumps(ret), content_type="application/json")

我的 django 版本

import django django.VERSION (2, 0, 2, 'final', 0)

debug 也是开的 DEBUG = True

麻烦各位大佬了,今天冒了两次泡哈哈

1267 次点击
所在节点    Python
2 条回复
fankcoder
2018-05-09 17:45:38 +08:00
哇 ,代码格式瞎了。。。
正常例子:

def test(request):

ret = {'test':1}

return HttpResponse(json.dumps(ret), content_type="application/json")

返回 in exception 例子:

def test(request):

asdfasdb #乱写的错误 ret = {'test':1} return HttpResponse(json.dumps(ret), content_type="application/json")
fankcoder
2018-05-09 17:46:48 +08:00
返回 in exception 例子:

def test(request):

asdfasdb #乱写的错误

ret = {'test':1}

return HttpResponse(json.dumps(ret), content_type="application/json")

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/453508

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX