Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

552
Views
Encabezado HTTP_HOST no válido: '0.0.0.0:8000'. Es posible que deba agregar '0.0.0.0' a ALLOWED_HOSTS

Django no parece encontrar mi host 0.0.0.0

Ya agregué "0.0.0.0" a mi ALLOWED_HOSTS. De hecho, si print(ALLOWED_HOSTS) obtengo ['localhost', '127.0.0.1', '0.0.0.0', '[::1]'] . Estoy trabajando en la ventana acoplable. ¿Hay algo que estoy pasando por alto?

.env.dev

 DEBUG=1 SECRET_KEY=foo DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 0.0.0.0 [::1] SQL_ENGINE=django.db.backends.postgresql SQL_DATABASE=xxxx SQL_USER=xxxx SQL_PASSWORD=xxxx SQL_HOST=db SQL_PORT=5432 DATABASE=postgres

env_settings.py

 import os # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.environ.get("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! # DEBUG = True DEBUG = int(os.environ.get("DEBUG", default=0)) ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

configuración.py

 from core.env_settings import * print(ALLOWED_HOSTS) """ print(ALLOWED_HOSTS) returns ['localhost', '127.0.0.1', '0.0.0.0', '[::1]'] """

NB: he revisado cuidadosamente todas las preguntas similares publicadas aquí y no hay ninguna con este problema específico.

over 4 years ago · Santiago Trujillo
5 answers
Answer question

0

Debe encontrar la dirección IP de su dispositivo desde donde está ejecutando la aplicación django.

Cómo encontrar la dirección IP local

Para usar django en la red local Ejecute el comando python manage.py runserver 0.0.0.0:8000

Para ejecutar en otro dispositivo conectado a la misma red local, debe escribir la dirección IP de su dispositivo servidor desde donde está ejecutando la aplicación django.

192.168.1.1:8000/ # esto es solo un ejemplo ficticio.

Debería funcionar siempre que ambos dispositivos estén conectados a la misma red. Y el cortafuegos está permitido.

over 4 years ago · Santiago Trujillo Report

0

Acabo de agregar la ip en la propiedad ALLOWED_HOSTS en el archivo <your_app_path>/ settings.py .

p.ej

 ... ALLOWED_HOSTS = ['0.0.0.0'] ...

Y funcionó bien.

over 4 years ago · Santiago Trujillo Report

0

ALLOWED_HOSTS = os.environ.get('DJANGO_ALLOWED_HOSTS', '*').split()

Acabo de agregar split() porque sin split() solo localhost 127.0.0.1 0.0.0.0 [::1] para django necesita la list .

over 4 years ago · Santiago Trujillo Report

0

en settings.py , cambie
ALLOWED_HOSTS = ['*']
este trabajo para mí, * representa todos los puertos pueden tener acceso al sitio

over 4 years ago · Santiago Trujillo Report

0

Eche un vistazo a settings.py y complete ALLOWED_HOSTS de la siguiente manera. Para anfitrión local:

 ALLOWED_HOSTS = ["0.0.0.0"]

O puedes hacer

 ALLOWED_HOSTS = ["*"]

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!