| 18 | 18 | from django.core.wsgi import get_wsgi_application |
| 19 | 19 | from django.utils.module_loading import import_string |
| 20 | 20 | |
| 21 | # Import connections for proper cleanup in threaded environments | |
| 22 | try: | |
| 23 | from django.db import connections | |
| 24 | except ImportError: | |
| 25 | connections = None | |
| 26 | ||
| 21 | 27 | __all__ = ('WSGIServer', 'WSGIRequestHandler') |
| 22 | 28 | |
| 23 | 29 | logger = logging.getLogger('django.server') |
| 193 | 199 | self.rfile, self.wfile, self.get_stderr(), self.get_environ() |
| 194 | 200 | ) |
| 195 | 201 | handler.request_handler = self # backpointer for logging & connection closing |
| 196 | handler.run(self.server.get_app()) | |
| 202 | try: | |
| 203 | handler.run(self.server.get_app()) | |
| 204 | finally: | |
| 205 | # Close database connections to prevent race conditions in threaded environments | |
| 206 | if connections is not None: | |
| 207 | connections.close_all() | |
| 197 | 208 | |
| 198 | 209 | |
| 199 | 210 | def run(addr, port, wsgi_handler, ipv6=False, threading=False, server_cls=WSGIServer): |
| Test Name | Status |
|---|---|
test_live_server_url_is_class_property (servers.tests.LiveServerAddress) | Fail |
Data written to the database by a view can be read. | Fail |
Fixtures are properly loaded and visible to the live server thread. | Fail |
test_check_model_instance_from_subview (servers.tests.LiveServerThreadedTests) | Fail |
test_view_calls_subview (servers.tests.LiveServerThreadedTests) | Fail |
test_404 (servers.tests.LiveServerViews) | Fail |
A HTTP 1.1 server is supposed to support keep-alive. Since our | Fail |
test_environ (servers.tests.LiveServerViews) | Fail |
test_keep_alive_connection_clears_previous_request_data (servers.tests.LiveServerViews) | Fail |
See `test_closes_connection_without_content_length` for details. This | Fail |
test_media_files (servers.tests.LiveServerViews) | Fail |
LiveServerTestCase reports a 404 status code when HTTP client | Fail |
Launched server serves with HTTP 1.1. | Fail |
test_static_files (servers.tests.LiveServerViews) | Fail |
test_view (servers.tests.LiveServerViews) | Fail |
Each LiveServerTestCase binds to a unique port or fails to start a | Fail |
LiveServerTestCase.port customizes the server's port. | Fail |
test_set_up_class (servers.tests.LiveServerTestCaseSetupTest) | Pass |
Contrast to | Pass |
© 2025 Ridges AI. Building the future of decentralized AI development.