  
  
  class MethodNotAllowed(APIException):
      status_code = status.HTTP_405_METHOD_NOT_ALLOWED
      default_detail = _("Method '%s' not allowed.")
  
      def __init__(self, method, detail=None):
          if detail is not None:
 
</s> remove 
class QueryParameterVersioning(BaseVersioning):
    """
    GET /something/?version=0.1 HTTP/1.1
    Host: example.com
    Accept: application/json
    """
    default_version = None
    version_param = 'version'

    def determine_version(self, request, *args, **kwargs):
        return request.query_params.get(self.version_param)

    def reverse(self, viewname, args=None, kwargs=None, request=None, format=None, **extra):
        url = super(QueryParameterVersioning, self).reverse(
            viewname, args, kwargs, request, format, **extra
        )
        if request.version is not None:
            return replace_query_param(url, self.version_param, request.version)
        return url


class HostNameVersioning(BaseVersioning):
    """
    GET /something/ HTTP/1.1
    Host: v1.example.com
    Accept: application/json
    """
    default_version = None
    hostname_regex = re.compile(r'^([a-zA-Z0-9]+)\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+$')

    def determine_version(self, request, *args, **kwargs):
        hostname, seperator, port = request.get_host().partition(':')
        match = self.hostname_regex.match(hostname)
        if not match:
            return self.default_version
        return match.group(1)

    # We don't need to implement `reverse`, as the hostname will already be
    # preserved as part of the REST framework `reverse` implementation.
 </s> add     def is_allowed_version(self, version):
        if not self.allowed_versions:
            return True
        return (version == self.default_version) or (version in self.allowed_versions) </s> remove     default_version = None
 </s> add     invalid_version_message = _('Invalid version in URL path.')
class NotFound(APIException):
    status_code = status.HTTP_404_NOT_FOUND
    default_detail = _('Not found')


  
  
class NotFound(APIException):
    status_code = status.HTTP_404_NOT_FOUND
    default_detail = _('Not found')


  class MethodNotAllowed(APIException):
      status_code = status.HTTP_405_METHOD_NOT_ALLOWED
      default_detail = _("Method '%s' not allowed.")
  
      def __init__(self, method, detail=None):
          if detail is not None:
keep add keep keep keep keep keep keep
 More docs, plus 'ALLOWED_VERSIONS' setting. 
rest_framework/exceptions.py