I have finished a Django project and want to deploy it over Apache2 locally over LAN. I have figured out how to connect Django with Apache2 using mod_wsgi and it worked great because I was able to use Apace2 to actually host Django on localhost. Now I want to actually make this project available to anyone on my local network. Like for instance assuming that my local IP address was 10.10.10.51 I could go to a different device connected to my local network and type in 10.10.10.51 to actually get to the Apache2 server homepage. It does that successfully. My Django project is hosted on my Apache2 localhost server at djangoproject.localhost and it works fine just on my PC. When I move on to the other PC and go to djangoproject.localhost the site is not up there. Yes they are both connected to the same LAN network. I used this tutorial to host Django on Apache2: Host Django on Apache2 with mod_wsgi
CodePudding user response:
I think that you have to configure something called port forwarding in your home modem, this video could help: https://www.youtube.com/watch?v=6gkoDQUQSLc
CodePudding user response:
I suppose you are on windows ... If you run your app on pc1 and want to call it from pc2, you need to call it either
via ip adress of pc1
via djangoproject.localhost
but then you need to edit the hosts file on pc2:
C:\Windows\System32\drivers\etc\hosts
and add something like (x.x.x.x = ip adress of pc1)
x.x.x.x djangoproject.localhost
because on pc2 your brwoser does not know what to do with djangoproject.localhost as in a LAN in general you do not have a local domain name server running.
If your firewall on pc1 blocks access to apache you need to got to "windows defender firewall" (type "defender" in search bar) and add a rule for apache application.