32π
It is should be done with central system or server.
By default manage.py runserver
will not give ip bind permission. So
Note that the default IP address, 127.0.0.1, is not accessible from other machines on your network. To make your development server viewable to other machines on the network, use its own IP address (e.g. 192.168.2.1) or 0.0.0.0 or :: (with IPv6 enabled).
If you want to check in your local machine then follow
python manage.py runserver 0.0.0.0:8000
Now go to your network computer and access your ip like 192.168.1.24:8000
Updated:
For Django version about 1.10 you should add your host to ALLOWED_HOSTS here
11π
Just add your own IP Address to ALLOWED_HOSTS
ALLOWED_HOSTS = [β192.168.1.50β, β127.0.0.1β, βlocalhostβ]
and run your server python manage.py runserver 192.168.1.50:8000
and access your own server to other computer in your network
- [Django]-"Cannot filter a query once a slice has been taken"
- [Django]-Validators = [MinValueValidator] does not work in Django
- [Django]-How can I use Bootstrap with Django?
7π
Run the application with IP address then access it in other machines.
python manage.py runserver 192.168.56.22:1234
Both machines should be in same network, then only this will work.
- [Django]-What is @permalink and get_absolute_url in Django?
- [Django]-When to use get, get_queryset, get_context_data in Django?
- [Django]-'SSLError' installing with pip
5π
This can be done in just 4 steps:
- Make sure in settings.py: ALLOWED_HOSTS = [β*β]
- Run the server using: python manage.py runserver 0.0.0.0:3000
- Go to Windows security -> Firewall & network protection and turn off the windows firewall completely.
Now at this point, your Django API can be accessed within your local network using the URL: http:// Your-LAN-IP-address:3000/
- Now we have to open port 3000. Go to http://192.168.1.1 and login into your router. Now go to Advanced tab -> NAT -> Virtual server and fill the following fields alone:
- WAN port β 3000
- LAN port β 3000
- LAN IP address β check your machine
Now at this point, your Django API can be accessed from anywhere using the URL:
http:// Your-Public-IP-address:3000/
- [Django]-Django: signal when user logs in?
- [Django]-How do I iterate over the options of a SelectField in a template?
- [Django]-Django ModelForm has no model class specified
5π
This is very very simple
python manage.py runserver 0.0.0.0:8000
change in setting.py
ALLOWED_HOSTS = ['*']
open linux terminal
sudo ifconfig
Get inet ipv4 address
Run on other same local network PC
- [Django]-No module named 'polls.apps.PollsConfigdjango'; Django project tutorial 2
- [Django]-How to resize an ImageField image before saving it in python Django model
- [Django]-Django select_for_update cannot be used outside of a transaction
0π
Check Your Computerβs Ip Address
These commands will tell you all network info
ip add
or
ifconfig -a
If as you say it only gives you 127.0.0.1 then there are two options:
-
Your network card is not attached or not recognized by the system
-
Your network DHCP server is not runnning or not connected
after that
add your ip address to your projectβs setting.py
file
in my case my ip is 192.168.1.24
ALLOWED_HOSTS = ['192.168.1.24', '127.0.0.1', 'localhost']
then run your project using
python manage.py runserver 192.168.1.24:8000
now you can access your project to other devices π
- [Django]-Drawbacks to running Django under PyPy?
- [Django]-How do I use the built in password reset/change views with my own templates
- [Django]-Change list display link in django admin
0π
very simple,
first you need to add ip to allowed host,
ALLOWED_HOST =[β*β]
2. then execute python manage.py runserver 0.0.0.0:8000
now you can access the local project on different system in the same network
- [Django]-How to pass django rest framework response to html?
- [Django]-Best way to store user-uploaded files in a webapp
- [Django]-Django β How to sort queryset by number of character in a field