我的 PC 上运行着一个 Django 服务器。我想通过我的 android 手机访问服务器。我该怎么做?我试过运行
python manage.py runserver 0.0.0.0:8000.
在此之后,我可以通过电脑的 ip 地址从我的电脑访问服务器,但不能通过连接到同一 wifi 的其他设备访问。
最佳答案
你需要做这些步骤
1. run python manage.py runserver 0.0.0.0:8000
2. figure out your ip address which is say 192.168.1.8
3. Add '192.168.1.8' to ALLOWED_HOSTS list in your settings.py file.
4. access 192.168.1.8:8000 on mobile.
我试过了,它对我有用。
关于android - 通过局域网访问django localhost服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42451790/