Sunday, May 31, 2020

Access windows web app from WSL2

It's long strong in Microsoft site.

To be short:
I have django in windows
python manage.py runserver --insecure 0.0.0.0:8000
Must use 0.0.0.0 in here.

In WSL2 ubuntu 20.04,
alex@DESKTOP:~$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this fil
e, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.28.112.1

Use the ip address in nameserver to access windows web app.

alex@DESKTOP:~$ curl -I http://172.28.112.1:8000/static/favicon.ico
HTTP/1.1 200 OK
Date: Sun, 31 May 2020 07:44:37 GMT
Server: WSGIServer/0.2 CPython/3.7.7
Content-Type: image/x-icon
Content-Length: 1150
Content-Disposition: inline; filename="favicon.ico"
Last-Modified: Thu, 05 Mar 2020 02:31:32 GMT

No comments: