[Python] 'ellipsis' object has no attribute 'lower' - When I run python3 manage.py runserver

Discussão em 'Python' iniciado por Stack, Maio 7, 2025.

  1. Stack

    Stack Membro Participativo

    I am running a web application(wagtail cms) on linux ubuntu. I am getting this error when I run python3 manage.py runserver 0.0.0.0:8000 Please see the error message on the console.

    Performing system checks...

    System check identified no issues (0 silenced).
    March 22, 2018 - 15:27:33
    Django version 1.11.1, using settings 'ntdl.settings'
    Starting development server at http://0.0.0.0:8000/
    Quit the server with CONTROL-C.
    Internal Server Error: /
    Traceback (most recent call last):
    File "/usr/local/lib/python3.6/dist-
    packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
    File "/usr/local/lib/python3.6/dist-packages/django/utils/deprecation.py",
    line 138, in __call__
    response = self.process_request(request)
    File "/usr/local/lib/python3.6/dist-
    packages/django/middleware/security.py", line 25, in process_request
    host = self.redirect_host or request.get_host()
    File "/usr/local/lib/python3.6/dist-packages/django/http/request.py", line
    105, in get_host
    if domain and validate_host(domain, allowed_hosts):
    File "/usr/local/lib/python3.6/dist-packages/django/http/request.py", line
    579, in validate_host
    if pattern == '*' or is_same_domain(host, pattern):
    File "/usr/local/lib/python3.6/dist-packages/django/utils/http.py", line
    291, in is_same_domain
    pattern = pattern.lower()
    AttributeError: 'ellipsis' object has no attribute 'lower'
    "GET / HTTP/1.1" 500 11959
    Internal Server Error: /favicon.ico
    Traceback (most recent call last):
    File "/usr/local/lib/python3.6/dist-
    packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
    File "/usr/local/lib/python3.6/dist-packages/django/utils/deprecation.py",
    line 138, in __call__
    response = self.process_request(request)
    File "/usr/local/lib/python3.6/dist-
    packages/django/middleware/security.py", line 25, in process_request
    host = self.redirect_host or request.get_host()
    File "/usr/local/lib/python3.6/dist-packages/django/http/request.py", line
    105, in get_host
    if domain and validate_host(domain, allowed_hosts):
    File "/usr/local/lib/python3.6/dist-packages/django/http/request.py", line
    579, in validate_host
    if pattern == '*' or is_same_domain(host, pattern):
    File "/usr/local/lib/python3.6/dist-packages/django/utils/http.py", line
    291, in is_same_domain
    pattern = pattern.lower()
    AttributeError: 'ellipsis' object has no attribute 'lower'
    "GET /favicon.ico HTTP/1.1" 500 11965


    I had gone inside the http.py checked the code it has code below

    def is_same_domain(host, pattern):
    """
    Return ``True`` if the host is either an exact match or a match
    to the wildcard pattern.

    Any pattern beginning with a period matches a domain and all of its
    subdomains. (e.g. ``.example.com`` matches ``example.com`` and
    ``foo.example.com``). Anything else is an exact string match.
    """
    if not pattern:
    return False

    pattern = pattern.lower()
    return (
    pattern[0] == '.' and (host.endswith(pattern) or host == pattern[1:])
    or
    pattern == host
    )


    I am not able see any errors here. Please help me in fixing this error.

    With Many Thanks,

    Bharath AK

    Continue reading...

Compartilhe esta Página