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

612
Views
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
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!