Access Django app from other computers

后端 未结 4 2023
臣服心动
臣服心动 2021-02-14 22:17

I am developing a web application on my local computer in Django.

Now I want my webapp to be accessible to other computers on my network. We have a common network drive

4条回答
  •  粉色の甜心
    2021-02-14 23:03

    This can be done in just 4 steps:

    1. Make sure in settings.py: ALLOWED_HOSTS = ['*']
    2. Run the server using: python manage.py runserver 0.0.0.0:3000
    3. Go to Windows security -> Firewall & network protection and turn off the windows firewall completely.

    Now at this point, your Django API can be accessed within your local network using the URL: http:// Your-LAN-IP-address:3000/

    1. Now we have to open port 3000. Go to http://192.168.1.1 and login into your router. Now go to Advanced tab -> NAT -> Virtual server and fill the following fields alone:
    • WAN port - 3000
    • LAN port - 3000
    • LAN IP address - check your machine

    Now at this point, your Django API can be accessed from anywhere using the URL: http:// Your-Public-IP-address:3000/

提交回复
热议问题