I have a django project in my pc.
In terminal I've run python3 manage.py runserver <my ipaddress>:8001
When I try to open the link in another pc, it is showing error page which says:
Invalid HTTP_HOST header: '<my ipaddress>:8001'. You may need to add '<my ipaddress>' to ALLOWED_HOSTS.
What should I do?
And moreover is it possible to put some text in place of ipaddress in the url?
For example, I want to host it as myproject/
instead of that complex url.
On one condition this will work
if both computers are on the same network like local Hotspot or same LAN network
steps:
ALLOWED_HOSTS = ['*']
0.0.0.0
and port any like 8000
using this commandmanage.py runserver 0.0.0.0:8000
run ifconfig
if you are using linux ipconfig
if windows then you will get your ip address of your server
Open browser in another computer and enter the ip of server shown in 3rd step with port as 8000
http://ip-of-server:8000
Instead of passing <my-ip-address>
to the runserver
command, pass 0.0.0.0
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With