=== modified file 'django/core/management/commands/runserver.py'
|
|
|
9 | 9 | help='Tells Django to NOT use the auto-reloader.'), |
10 | 10 | make_option('--adminmedia', dest='admin_media_path', default='', |
11 | 11 | 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.'), |
12 | 14 | ) |
13 | 15 | help = "Starts a lightweight Web server for development." |
14 | 16 | args = '[optional port number, or ipaddr:port]' |
… |
… |
|
37 | 39 | raise CommandError("%r is not a valid port number." % port) |
38 | 40 | |
39 | 41 | use_reloader = options.get('use_reloader', True) |
| 42 | serve_admin_media = options.get('serve_admin_media', False) |
40 | 43 | admin_media_path = options.get('admin_media_path', '') |
41 | 44 | shutdown_message = options.get('shutdown_message', '') |
42 | 45 | quit_command = (sys.platform == 'win32') and 'CTRL-BREAK' or 'CONTROL-C' |
… |
… |
|
50 | 53 | print "Quit the server with %s." % quit_command |
51 | 54 | try: |
52 | 55 | 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() |
54 | 60 | run(addr, int(port), handler) |
55 | 61 | except WSGIServerException, e: |
56 | 62 | # Use helpful error messages instead of ugly tracebacks. |