Django

Code

Changeset 6204

Show
Ignore:
Timestamp:
09/14/07 14:17:15 (1 year ago)
Author:
adrian
Message:

Fixed #5376 -- Added --addrport option to the 'testserver' command. Thanks, toddobryan

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/management/commands/testserver.py

    r6075 r6204  
    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).' 
     
    2023 
    2124        verbosity = int(options.get('verbosity', 1)) 
     25        addrport = options.get('addrport') 
    2226 
    2327        # Create a test database. 
     
    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) 
  • django/trunk/docs/django-admin.txt

    r6077 r6204  
    628628      being made to a test database. 
    629629 
    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. 
    632  
    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. 
     630Note that this server does *not* automatically detect changes to your Python 
     631source code (as ``runserver`` does). It does, however, detect changes to 
     632templates. 
    635633 
    636634.. _unit tests: ../testing/ 
     635 
     636--addrport [port number or ipaddr:port] 
     637~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     638 
     639Use ``--addrport`` to specify a different port, or IP address and port, from 
     640the default of 127.0.0.1:8000. This value follows exactly the same format and 
     641serves exactly the same function as the argument to the ``runserver`` subcommand. 
     642 
     643Examples: 
     644 
     645To run the test server on port 7000 with ``fixture1`` and ``fixture2``:: 
     646 
     647    django-admin.py testserver --addrport 7000 fixture1 fixture2 
     648    django-admin.py testserver fixture1 fixture2 --addrport 8080 
     649 
     650(The above statements are equivalent. We include both of them to demonstrate 
     651that it doesn't matter whether the options come before or after the 
     652``testserver`` command.) 
     653 
     654To run on 1.2.3.4:7000 with a `test` fixture:: 
     655 
     656    django-admin.py testserver --addrport 1.2.3.4:7000 test 
    637657 
    638658--verbosity