How to access the local Django webserver from outside world

前端 未结 9 1731
天命终不由人
天命终不由人 2020-12-02 04:06

I followed the instructions here to run Django using the built-in webserver and was able to successfully run it using python manage.py runserver. If I access 1

9条回答
  •  孤街浪徒
    2020-12-02 04:47

    just do this:

    python manage.py runserver 0:8000
    

    by the above command you are actually binding it to the external IP address. so now when you access your IP address with the port number, you will be able to access it in the browser without any problem.

    just type in the following in the browser address bar:

    :8000
    

    eg:

    192.168.1.130:8000
    

    you may have to edit the settings.py add the following in the settings.py in the last line:

    ALLOWED_HOSTS = ['*']
    

    hope this will help...

提交回复
热议问题