def runserver(addr, port, use_reloader=True, admin_media_dir=''):
    "Starts a lightweight Web server for development."
    from django.core.servers.basehttp import run, AdminMediaHandler, WSGIServerException
    from django.core.handlers.wsgi import WSGIHandler
    if not addr:
        addr = '127.0.0.1'
    if not port.isdigit():
        sys.stderr.write(style.ERROR("Error: %r is not a valid port number.\n" % port))
        sys.exit(1)
    quit_command = sys.platform == 'win32' and 'CTRL-BREAK' or 'CONTROL-C'
    def inner_run():
        from django.conf import settings
        print "Validating models..."
        validate()
        print "\nDjango version %s, using settings %r" % (get_version(), settings.SETTINGS_MODULE)
        print "Development server is running at http://%s:%s/" % (addr, port)
        print "Quit the server with %s." % quit_command
        try:
            handler = AdminMediaHandler(WSGIHandler(), admin_media_path)
            run(addr, int(port), handler)
        except WSGIServerException, e:
            # Use helpful error messages instead of ugly tracebacks.
            ERRORS = {
                13: "You don't have permission to access that port.",
                98: "That port is already in use.",
                99: "That IP address can't be assigned-to.",
            }
            try:
                error_text = ERRORS[e.args[0].args[0]]
            except (AttributeError, KeyError):
                error_text = str(e)
            sys.stderr.write(style.ERROR("Error: %s" % error_text) + '\n')
            sys.exit(1)
        except KeyboardInterrupt:
            sys.exit(0)
    if use_reloader:
        from django.utils import autoreload
        autoreload.main(inner_run)
    else:
        inner_run()
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/core/management.py/runserver/original