Ticket #2879: core-management.patch
File core-management.patch, 1.9 KB (added by , 17 years ago) |
---|
-
django/core/management.py
1158 1158 sys.stderr.write(s.read()) 1159 1159 sys.exit(1) 1160 1160 1161 def runtestserver(addr, port, use_reloader=False, admin_media_dir=''): 1162 "Starts a lightweight Web server for testing." 1163 from django.test.utils import setup_test_environment, teardown_test_environment 1164 from django.test.utils import create_test_db, destroy_test_db 1165 from django.conf import settings 1166 1167 setup_test_environment() 1168 old_name = settings.DATABASE_NAME 1169 create_test_db() 1170 1171 # Install the 'testdata' fixture, using format discovery 1172 load_data(['test_data'], verbosity=True) 1173 1174 try: 1175 use_reloader = False # Must always be False ! 1176 runserver(addr, port, use_reloader, admin_media_dir) 1177 except SystemExit: 1178 destroy_test_db(old_name) 1179 teardown_test_environment() 1180 raise 1181 1182 destroy_test_db(old_name) 1183 teardown_test_environment() 1184 runtestserver.args = '[--adminmedia=ADMIN_MEDIA_PATH] [optional port number, or ipaddr:port]' 1185 1161 1186 def runserver(addr, port, use_reloader=True, admin_media_dir=''): 1162 1187 "Starts a lightweight Web server for development." 1163 1188 from django.core.servers.basehttp import run, AdminMediaHandler, WSGIServerException … … 1468 1493 'reset': reset, 1469 1494 'runfcgi': runfcgi, 1470 1495 'runserver': runserver, 1496 'runtestserver': runtestserver, 1471 1497 'shell': run_shell, 1472 1498 'sql': get_sql_create, 1473 1499 'sqlall': get_sql_all, … … 1603 1629 except IndexError: 1604 1630 parser.print_usage_and_exit() 1605 1631 action_mapping[action](name, os.getcwd()) 1606 elif action == 'runserver':1632 elif action in ('runserver', 'runtestserver'): 1607 1633 if len(args) < 2: 1608 1634 addr = '' 1609 1635 port = '8000'