Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to allow others to connect to my Django website?

Now that I have created a website, I wish the users can connect to my website within a local network. However my website now can only be accessible from the localhost (my pc), the others are not able to connect to my website when typing my ip address for example xxx.xxx.xxx.xxx:8000 on their browser. I launch the service on my localhost using # python manage.py runserver. May I know if there is a way/command to allow the others to connect to my website?

Note: I have tried # python manage.py runserver 0.0.0.0:8000 as well, which allow all incoming, but it didn't work.

like image 314
T08 Avatar asked Oct 27 '25 08:10

T08


1 Answers

In settings.py write

ALLOWED_HOSTS = ['*'] and run python manage.py runserver 0.0.0.0:8000

Note: you can use any port instead of 8000

like image 183
Shaon shaonty Avatar answered Oct 29 '25 23:10

Shaon shaonty



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!