I have a Raspberry PI with Django installed. The PI has a static IP on my network ( 192.168.1.100
) and the web server is on port 8008.
I can access my website from the local network at the address http://192.168.1.100:8008/
as one would expect.
On my routeur, with WAN address (say) 1.1.1.1
, I forwarded port 8008 to the IP 192.168.1.100
and therefore I should expect http://1.1.1.1:8008/
to show me my website. However it doesn't.
When I redirect port 8008 to another PC where I have an Apache server on port 8008, it works fine from the outside. I only have the problem on this device.
The Django app itself does not seem to reject connections from the outside (I installed it on my Mac on a different network and I could access it from the outside).
So I don't know what I am missing... is there some parameter on the PI that could block requests?
Here's a quick solution. You can try services like localtunnel or ngrok to port forward.
Or if you want a more rigid solution you could forward ports from your router.
Or at last you could use a reverse proxy from cloud or a VPN network.
Choose whatever suits your situation the best.
在 settings.py 中,尝试将您的 WAN 地址添加到允许的主机
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.