Reputation: 315
I am building a website for myself and family in Django and React. Every time I ask them to check my process and get their opinions they get a webpage not found error or this site can't be reached. How do I make is so that anyone on my local network can check my page when its running. This is the default in flask, I don't understand why django runs like this? (safety maybe?) I can't find any good information on how to add an allow all to the ALLOWED_HOSTS section in the settings of the main app.
I also know that you can add IP address, But I'm a noob and I don't follow how to get the ip address of all my families devices without alot of work?? Does anyone have a good solution for this??
Upvotes: 2
Views: 6960
Reputation: 21
It is very simple
Upvotes: 2
Reputation: 130
Django documentation:
When DEBUG is True and ALLOWED_HOSTS is empty, the host is validated against ['.localhost', '127.0.0.1', '[::1]'].
If you are in debug mode with an empty list, or in non-debug mode also with an empty list, no one in your LAN network could be accessed to your website.
In this case, because you are in a LAN, you could use:
ALLOWED_HOSTS = ['*']
Then run
python manage.py runserver 0.0.0.0:8000
You don't need to open any ports on your router if you are in LAN, but maybe you need to configure your firewall in your local machine.
Otherwise, a web server like nginx or apache is recommended.
Upvotes: 3
Reputation: 7713
ALLOWED_HOSTS = ['*']
But this is not your real problem. You'll most likely need to open ports in the firewall of either your local machine or your router (or both) before other machines on the network will be able to reach yours.
Upvotes: 1
Reputation: 2334
If all are on the same network then run
python manage.py runserver 0.0.0.0:8000
Upvotes: 1