推荐学习书目
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 · May 9, 2018 · 1711 views
    This topic created in 2951 days ago, the information mentioned may be changed or developed.

    所有的错误统一都返回 "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 replies    2018-05-09 17:46:48 +08:00
    fankcoder
        1
    fankcoder  
    OP
       May 9, 2018
    哇 ,代码格式瞎了。。。
    正常例子:

    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
       May 9, 2018
    返回 in exception 例子:

    def test(request):

    asdfasdb #乱写的错误

    ret = {'test':1}

    return HttpResponse(json.dumps(ret), content_type="application/json")
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   905 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 19:35 · PVG 03:35 · LAX 12:35 · JFK 15:35
    ♥ Do have faith in what you're doing.