MCPcopy
hub / github.com/django/django / run

Method run

django/test/testcases.py:1749–1775  ·  view source on GitHub ↗

Set up the live server and databases, and then loop over handling HTTP requests.

(self)

Source from the content-addressed store, hash-verified

1747 super().__init__()
1748
1749 def run(self):
1750 """
1751 Set up the live server and databases, and then loop over handling
1752 HTTP requests.
1753 """
1754 if self.connections_override:
1755 # Override this thread's database connections with the ones
1756 # provided by the main thread.
1757 for alias, conn in self.connections_override.items():
1758 connections[alias] = conn
1759 try:
1760 # Create the handler for serving static and media files
1761 handler = self.static_handler(_MediaFilesHandler(WSGIHandler()))
1762 self.httpd = self._create_server(
1763 connections_override=self.connections_override,
1764 )
1765 # If binding to port zero, assign the port allocated by the OS.
1766 if self.port == 0:
1767 self.port = self.httpd.server_address[1]
1768 self.httpd.set_app(handler)
1769 self.is_ready.set()
1770 self.httpd.serve_forever()
1771 except Exception as e:
1772 self.error = e
1773 self.is_ready.set()
1774 finally:
1775 connections.close_all()
1776
1777 def _create_server(self, connections_override=None):
1778 return self.server_class(

Callers

nothing calls this directly

Calls 6

_create_serverMethod · 0.95
WSGIHandlerClass · 0.90
_MediaFilesHandlerClass · 0.85
close_allMethod · 0.80
itemsMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected