I want to access my django app by both localhost
as well as the ip_address of device. How can I do it?
In Flask, we can share the app in network by passing host='0.0.0.0'
as argument in app.run()
.
Example: app.run(host='0.0.0.0')
And the flask gives links for both localhost (127.0.0.1:5000)
and for the network (ip_address:5000
).
How can I achieve same for Django?
I've tried passing 0.0.0.0
and the 'ip_address' in the ALLOWED_HOSTS
list in settings.py
but didn't work.
I know about command: python manage.py runserver ip_address:8000
but then app is not accessible by localhost:8000
:(