V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
fankcoder
V2EX  ›  Python

django 不会正常报错了

  •  
  •   fankcoder ·
    fankcoder · 2018-05-09 17:44:11 +08:00 · 1260 次点击
    这是一个创建于 2172 天前的主题,其中的信息可能已经有所发展或是发生改变。

    所有的错误统一都返回 "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

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

    2 条回复    2018-05-09 17:46:48 +08:00
    fankcoder
        1
    fankcoder  
    OP
       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
        2
    fankcoder  
    OP
       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")
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2431 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 16:01 · PVG 00:01 · LAX 09:01 · JFK 12:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.