Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 632 Bytes

django-tips.md

File metadata and controls

41 lines (32 loc) · 632 Bytes
layout permalink title
page
/django-tips
Django Tips

{% include tag-pages-loop.html tagName='Django' %}

Debugging

import pdb
pdb.set_trace()

Testing

We used Pytest which is built-in.

Testing tools like mocks and factories are also built in. To run tests: poetry run pytest.

Annotations to mark tests that access the DB

@pytest.mark.django_db
@patch("psycopg2.connect")

Celery

  • Tasks. These use annotations like @task
  • Signals. These are a triggering mechanisms.

Inspecting objects in the console

Rails:

object.inspect

Django:

Object.__dict__