简体   繁体   中英

How to locally host a Django project?

I am trying to run a Django website, and I want the ability for all devices that are connected to the same router as my computer to be able to access the website. I have looked in several places, and questions like this , or this .

In summary, the first links says that I should run my server with python manage.py runserver 0.0.0.0:8000 , and that will allow to access it from my cellphone. The second link said the same thing, but instead of 0.0.0.0 , it said that I should use my own IP address while running the runserver command. Neither approaches worked. I can access the website from my computer, but not from my cellphone, for example. (Both connected to 'X' network)

I really don't know what to do since I can't find another answer, possibly because I am not searching for the question correctly, but I would love it if anyone could help me.

I tried sharing internet from my cellphone and using its IP address, and that worked. I think this points out that it is maybe a problem with my router or internet provider. I don't know.

if you run the web on your computer you can do this python manage.py runserver 0.0.0.0:Computer-IP or localhost:Computer-IP, you can run the command ifconfig, find, eno and then you find inet 192.168.100.xx copy this

don't forget to enter your application folder settings.py ALLOWED_HOSTS = [] change like this ALLOWED_HOSTS = ["*"]

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM