Ticket #5376: testserver-addrport.patch

File testserver-addrport.patch, 3.1 KB (added by Todd O'Bryan, 10 years ago)
  • django/core/management/commands/testserver.py

    Property changes on: .
    Name: svn:ignore
       - build
       + build
    77        make_option('--verbosity', action='store', dest='verbosity', default='1',
    88            type='choice', choices=['0', '1', '2'],
    99            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'),
    1013    )
    1114    help = 'Runs a development server with data from the given fixture(s).'
    1215    args = '[fixture ...]'
    1922        from django.test.utils import create_test_db
    2124        verbosity = int(options.get('verbosity', 1))
     25        addrport = options.get('addrport')
    2327        # Create a test database.
    2428        db_name = create_test_db(verbosity=verbosity)
    3034        # a strange error -- it causes this handle() method to be called
    3135        # multiple times.
    3236        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

    627627      in any way, knowing that whatever data changes you're making are only
    628628      being made to a test database.
    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.
     630Note that this server does *not* automatically detect changes to your Python
     631source code (as ``runserver`` does). It does, however, detect changes to
    633 Also note that it does *not* automatically detect changes to your Python source
    634 code (as ``runserver`` does). It does, however, detect changes to templates.
    636634.. _unit tests: ../testing/
     636--addrport [port number or ipaddr:port]
     639Use ``--addrport`` to specify a different port, or IP address and port, from
     640the default of The argument to the ``--addrport`` option
     641follows exactly the same format and serves exactly the same function as the
     642argument to the ``runserver`` subcommand.
     646To run the test server on port 7000 with ``fixture1`` and ``fixture2``::
     648    django-admin.py testserver --addrport 7000 fixture1 fixture2
     650To run on with a `test` fixture::
     652    django-admin.py testserver --addrport test
Back to Top