Ticket #14582: ticket-14582.diff

File ticket-14582.diff, 1.6 KB (added by tkaemming, 14 years ago)

Adds --nostatic option to "runserver" management command.

  • django/core/management/commands/runserver.py

    diff --git a/django/core/management/commands/runserver.py b/django/core/management/commands/runserver.py
    index 21391e8..4c58500 100644
    a b class Command(BaseCommand):  
    1111            help='Tells Django to NOT use the auto-reloader.'),
    1212        make_option('--adminmedia', dest='admin_media_path', default='',
    1313            help='Specifies the directory from which to serve admin media.'),
     14        make_option('--nostatic', action="store_false", dest='use_static_handler', default=True,
     15            help='Prevents Django from automatically serving static assets at STATICFILES_URL.')
    1416    )
    1517    help = "Starts a lightweight Web server for development."
    1618    args = '[optional port number, or ipaddr:port]'
    class Command(BaseCommand):  
    4244        use_reloader = options.get('use_reloader', True)
    4345        admin_media_path = options.get('admin_media_path', '')
    4446        shutdown_message = options.get('shutdown_message', '')
     47        use_static_handler = options.get('use_static_handler', True)
    4548        quit_command = (sys.platform == 'win32') and 'CTRL-BREAK' or 'CONTROL-C'
    4649
    4750        def inner_run():
    class Command(BaseCommand):  
    6063
    6164            try:
    6265                handler = WSGIHandler()
    63                 handler = StaticFilesHandler(handler)
     66                if use_static_handler:
     67                    handler = StaticFilesHandler(handler)
    6468                # serve admin media like old-school (deprecation pending)
    6569                handler = AdminMediaHandler(handler, admin_media_path)
    6670                run(addr, int(port), handler)
Back to Top