Ticket #5376: testserver-addrport.patch
File testserver-addrport.patch, 3.1 KB (added by , 17 years ago) |
---|
-
django/core/management/commands/testserver.py
Property changes on: . ___________________________________________________________________ Name: svn:ignore - build dist *.egg-info MANIFEST + build dist *.egg-info MANIFEST .settings .project .pydevproject
7 7 make_option('--verbosity', action='store', dest='verbosity', default='1', 8 8 type='choice', choices=['0', '1', '2'], 9 9 help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), 10 make_option('--addrport', action='store', dest='addrport', 11 type='string', default='', 12 help='port number or ipaddr:port to run the server on'), 10 13 ) 11 14 help = 'Runs a development server with data from the given fixture(s).' 12 15 args = '[fixture ...]' … … 19 22 from django.test.utils import create_test_db 20 23 21 24 verbosity = int(options.get('verbosity', 1)) 25 addrport = options.get('addrport') 22 26 23 27 # Create a test database. 24 28 db_name = create_test_db(verbosity=verbosity) … … 30 34 # a strange error -- it causes this handle() method to be called 31 35 # multiple times. 32 36 shutdown_message = '\nServer stopped.\nNote that the test database, %r, has not been deleted. You can explore it on your own.' % db_name 33 call_command('runserver', shutdown_message=shutdown_message, use_reloader=False)37 call_command('runserver', addrport=addrport, shutdown_message=shutdown_message, use_reloader=False) -
docs/django-admin.txt
627 627 in any way, knowing that whatever data changes you're making are only 628 628 being made to a test database. 629 629 630 Note that this server can only run on the default port on localhost; it does 631 not yet accept a ``host`` or ``port`` parameter. 630 Note that this server does *not* automatically detect changes to your Python 631 source code (as ``runserver`` does). It does, however, detect changes to 632 templates. 632 633 633 Also note that it does *not* automatically detect changes to your Python source634 code (as ``runserver`` does). It does, however, detect changes to templates.635 636 634 .. _unit tests: ../testing/ 637 635 636 --addrport [port number or ipaddr:port] 637 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 639 Use ``--addrport`` to specify a different port, or IP address and port, from 640 the default of 127.0.0.1:8000. The argument to the ``--addrport`` option 641 follows exactly the same format and serves exactly the same function as the 642 argument to the ``runserver`` subcommand. 643 644 Examples: 645 646 To run the test server on port 7000 with ``fixture1`` and ``fixture2``:: 647 648 django-admin.py testserver --addrport 7000 fixture1 fixture2 649 650 To run on 1.2.3.4:7000 with a `test` fixture:: 651 652 django-admin.py testserver --addrport 1.2.3.4:7000 test 653 638 654 --verbosity 639 655 ~~~~~~~~~~~ 640 656