Django how to see generated SQL query?

后端 未结 2 990
再見小時候
再見小時候 2021-02-10 13:10

I have a form which takes data and is supposed to insert it into a database. When I am processing that form it gives me a value error, but when I go to the database and try to i

2条回答
  •  伪装坚强ぢ
    2021-02-10 13:48

    If you happen to use PyCharm, running your application in the debugger gives you the full context. Set a breakpoint, and browse in your app to the point you are having the error and get a screen like (trivial example):

    Running in this way has changed the way I troubleshoot when using Django. I suspect other IDE's may have similar features. Some further video documentation of the process from the vendor at: https://www.youtube.com/watch?v=QJtWxm12Eo0

    As Jayground suggested, logging is probably something you'll turn on eventually anyway; great suggestion.

提交回复
热议问题