Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

620
Visualizações
Flask running in WSL2 cannot connect to postgres running on windows (did work with WSL1)

I have started to develop a Flask app using VSCode/WSL1 and have then migrated from WSL1 to WSL2.

Since then, I cannot connect to my the database running on windows using "localhost"

DATABASE_URI = 'postgresql://sysadmin:mypassword@localhost/db_dev'

I can only connect if use the ip address found in "cat /etc/resolv.conf"

DATABASE_URI = 'postgresql://sysadmin:mypassword@172.31.96.1:5432/db_dev'

But that IP address changes on every reboot, so that is not convenient at all. It looks like networking has changed quite a bit between WSL and WSL2, but I cannot find an acceptable solution to this I would say rather basic issue.

There are no problems with my Postgres config, as I can connect using the ip address.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda