Access Django app from other computers

后端 未结 4 2015
臣服心动
臣服心动 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:22

    It is should be done with central system or server.

    By default manage.py runserver will not give ip bind permission. So

    Note that the default IP address, 127.0.0.1, is not accessible from other machines on your network. To make your development server viewable to other machines on the network, use its own IP address (e.g. 192.168.2.1) or 0.0.0.0 or :: (with IPv6 enabled).

    If you want to check in your local machine then follow

    python manage.py runserver 0.0.0.0:8000

    Now go to your network computer and access your ip like 192.168.1.24:8000

    Updated:

    For Django version about 1.10 you should add your host to ALLOWED_HOSTS here

提交回复
热议问题