Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Django

The web framework for perfectionists with deadlines.

Documentation

Help us reach our 2025 fundraising goal!

Donate to theDjango Software Foundation to fund Django's development, security, and community events!
If you got value out of using Django this year, please consider making a donation ♥
Donate today

Testing in Django

Automated testing is an extremely useful bug-killing tool for the modernweb developer. You can use a collection of tests – atest suite – tosolve, or avoid, a number of problems:

  • When you’re writing new code, you can use tests to validate your codeworks as expected.

  • When you’re refactoring or modifying old code, you can use tests toensure your changes haven’t affected your application’s behaviorunexpectedly.

Testing a web application is a complex task, because a web application is madeof several layers of logic – from HTTP-level request handling, to formvalidation and processing, to template rendering. With Django’s test-executionframework and assorted utilities, you can simulate requests, insert test data,inspect your application’s output and generally verify your code is doing whatit should be doing.

The preferred way to write tests in Django is using theunittest modulebuilt-in to the Python standard library. This is covered in detail in theWriting and running tests document.

You can also use anyother Python test framework; Django provides an API andtools for that kind of integration. They are described in theUsing different testing frameworks section ofAdvanced testing topics.

Back to Top

Additional Information

Support Django!

Support Django!

Contents

Getting help

FAQ
Try the FAQ — it's got answers to many common questions.
Index,Module Index, orTable of Contents
Handy when looking for specific information.
Django Discord Server
Join the Django Discord Community.
Official Django Forum
Join the community on the Django Forum.
Ticket tracker
Report bugs with Django or Django documentation in our ticket tracker.

Download:

Offline (development version):HTML |PDF |ePub
Provided byRead the Docs.

Diamond and Platinum Members

Sentry
JetBrains
This document is for Django's development version, which can be significantly different from previous releases. For older releases, use the version selector floating in the bottom right corner of this page.

[8]ページ先頭

©2009-2025 Movatter.jp