Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update runserver.py #17672

Closed
wants to merge 1 commit into from
Closed

Update runserver.py #17672

wants to merge 1 commit into from

Conversation

devnamdev2003
Copy link

Description:
Modified the default behavior of the runserver command to automatically bind to the host machine's IP address instead of the default 127.0.0.1 loopback address. This change allows the Django development server to be accessed by devices on the same network, enhancing accessibility for testing and development.

Details:

  • Added code to dynamically determine the host machine's IP address using socket.gethostname() and socket.gethostbyname(hostname).
  • In case of an exception (e.g., if the host machine is not connected to a network), falls back to the default address 127.0.0.1.

Impact:

  • Running python manage.py runserver now defaults to the host machine's IP address, making the development server accessible to devices within the same network.
  • Developers can still specify a different address/port if needed, but the default behavior enhances ease of access for testing on multiple devices.

@felixxm
Copy link
Member

felixxm commented Jan 3, 2024

OK, you forced me to block your account 🤷

@felixxm felixxm closed this Jan 3, 2024
@felixxm felixxm added the invalid label Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants