0

I'm working with PyCharm and I wonder if there's a way to make the Django embedded server accesible for the other hosts in my local network or I need to deploy my app on a dedicated web server such as Apache?

Now, I'm accessing my Django app like this in the browser:

http://localhost:8000/mypage/ 

and I want other users inside my local network to type:

http://my_private_ip:8000/mypage/ 

in their browsers and see the same page.

2 Answers 2

1

Just run the server (which is Django's embedded server FWIW, not PyCharm's) under http://my_private_ip:8000:

 # ./manage.py help runserver Usage: manage.py runserver [options] [optional port number, or ipaddr:port] Starts a lightweight Web server for development. (...) # ./manage.py runserver my_private_ip:8000 
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you bruno desthuilliers. This is what I was looking for.
0

Assuming a Unix environment.

You need to ensure the server is listening not on the lo interface but on all interfaces (or at least the one used to connect to the LAN).

If you can customize the way PyCharm launches the server, use 0.0.0.0 as the host, as in:

 python manage.py runserver 0.0.0.0:8000 

Your coworkers can then use your LAN IP address. If you don't know it, use $ ip a.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.