Running mysite.com on local machine for wsl (linux) during django development.

Hello I need assistance.

I am a junior dev learning django from Django-5-By-Example.

I want to run mysite.com on https during django development but I am failing.
I have installed django-extensions and Werkzeug to runserver_plus command.

I have edited my /etc/hosts file as follows

When I run https://localhost:8443 it runs well but for mysite.com it fails any assistance, I will be glad.

I tried this python3manage.py runserver_plus --key-file selftest-key --cert-file selftest-cert localhost:8443

It only helps me to run https://localhost:8443

but python3 manage.py runserver_plus --key-file selftest-key --cert-file selftest-cert mysite.com:8443
returns Firefox can’t establish a connection to the server at mysite.com:8443.

Any help will be much appreciated.
Thank you.

Hello Team.

It finally worked. Below are the approaches that I took.

The fact that I am using WSL2, I had to install chrome on my Linux Subsystem using the following commands.

while on WSL2 navigate to cd tmp/ then issue this commands and run the django server, don’t forget to edit the /etc/hosts file, the wsl.config to edit it’s settings such that it doesn’t automatically edit the /etc/hosts file and also making the /etc/hosts file readable and writable by sudo chmod a+rw as I had done before.

This one downloads chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

This one install chrome.
sudo dpkg -i google-chrome-stable_current_amd64.deb

This one repairs any errors.
sudo apt --fix-broken install

This launches chrome.
google-chrome-stable

Then run python3 manage.py runserver_plus --key-file selftest-key –
cert-file selftest-cert mysite.com:8000

I believe you also should have been able to resolve this by editing your Windows hosts file. (C:\Windows\System32\drivers\etc\hosts) Since it is used to create your /etc/hosts/ file, changes made to it would propagate through to WSL.

Thank you, this too worked, I am humbled.