Python-How to debug Django with Pycharm? Can you print out the data structure of the variable, the details of the structures, PHP-like data structures

Source: Internet
Author: User
How do I debug Django with Pycharm? Can you print out the data structure of the variable, the details of the structures, similar to the PHP structure? The data structure printed out by print is not detailed.
For example, there is a article data sheet model, I passed article1 = Article.objects.get (id=1), got Article1, and then Print (ARTICLE1), the result is, Can this data structure believe the point again? It doesn't even know if it's a data of your own.

Reply content:

How do I debug Django with Pycharm? Can you print out the data structure of the variable, the details of the structures, similar to the PHP structure? The data structure printed out by print is not detailed.
For example, there is a article data sheet model, I passed article1 = Article.objects.get (id=1), got Article1, and then Print (ARTICLE1), the result is, Can this data structure believe the point again? It doesn't even know if it's a data of your own.

Can directly

print(article1.__dict__)

Print out the properties of the object, and don't know if it solves your problem.

Customizable __str__ method to set print content

See Pycharm Official website Introduction is to support the Django environment debugging. Using the 30-day trial version, is indeed supported, you can set breakpoints, single-step tracking, view variable content and so on.

It is possible to set the assertion directly, I have used it before!

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.