I have a local network with 10 computers.
How can i run a django app locally, so that each of the 10 computers can access the app?
First, choose a computer to run the Django webserver on.
On this computer, follow the tutorial on how to run a django webserver.
For example: python manage.py runserver 0.0.0.0:8000
0.0.0.0
exposes your computer's IP address to the network interface. I would also recommend adding ALLOWED_HOSTS = ['*']
to your config file so that django doesn't apply security rules to any visiting IP address. Note: If you have the IP addrs of the devices on your network, you can add them as comma separated strings inside the brackets.
For example ALLOWED_HOSTS = ['xxx.xxx.xx.xx', 'xxx.xxx.xx.x']
You should be able to access the /
route on your webserver now by typing in the IP address of your host computer followed by :8000
. For example: xxx.xxx.xx.xx:8000
.
If your host is running linux you can find its' IP by typing ifconfig
in the terminal, or on Windows ipconfig
in your shell of choice.
You can also modify the /etc/hosts
file to point yoursite
to xxx.xxx.xx.xx:8000
and then type in yoursite
to the browser and it should be able to resolve to your webserver. If you're new to sysadmin-related things though, I would avoid doing this as it can mess up DNS resolution.