Ticket #10323: mocksoul_dont_force_admin_media_serving.patch

File mocksoul_dont_force_admin_media_serving.patch, 1.7 KB (added by Vadim Fint, 16 years ago)
  • django/core/management/commands/runserver.py

    === modified file 'django/core/management/commands/runserver.py'
     
    99            help='Tells Django to NOT use the auto-reloader.'),
    1010        make_option('--adminmedia', dest='admin_media_path', default='',
    1111            help='Specifies the directory from which to serve admin media.'),
     12        make_option('--disable-admin-media', action='store_false', dest='serve_admin_media', default=True,
     13            help='Disable serving of admin media files.'),
    1214    )
    1315    help = "Starts a lightweight Web server for development."
    1416    args = '[optional port number, or ipaddr:port]'
     
    3739            raise CommandError("%r is not a valid port number." % port)
    3840
    3941        use_reloader = options.get('use_reloader', True)
     42        serve_admin_media = options.get('serve_admin_media', False)
    4043        admin_media_path = options.get('admin_media_path', '')
    4144        shutdown_message = options.get('shutdown_message', '')
    4245        quit_command = (sys.platform == 'win32') and 'CTRL-BREAK' or 'CONTROL-C'
     
    5053            print "Quit the server with %s." % quit_command
    5154            try:
    5255                path = admin_media_path or django.__path__[0] + '/contrib/admin/media'
    53                 handler = AdminMediaHandler(WSGIHandler(), path)
     56                if serve_admin_media:
     57                    handler = AdminMediaHandler(WSGIHandler(), path)
     58                else:
     59                    handler = WSGIHandler()
    5460                run(addr, int(port), handler)
    5561            except WSGIServerException, e:
    5662                # Use helpful error messages instead of ugly tracebacks.
Back to Top