Django 通过无线网络设置本地ip以在Ubuntu上创建本地服务器
我使用的是GNU/Linux Ubuntu 13.04 Raring Ringtail x32位。我有一个无线网络连接在我的房子,我希望其他计算机连接看到我的本地主机 我使用Python Django 1.4创建了一个网页,它在Django 通过无线网络设置本地ip以在Ubuntu上创建本地服务器,django,ubuntu,localhost,network-protocols,wireless,Django,Ubuntu,Localhost,Network Protocols,Wireless,我使用的是GNU/Linux Ubuntu 13.04 Raring Ringtail x32位。我有一个无线网络连接在我的房子,我希望其他计算机连接看到我的本地主机 我使用Python Django 1.4创建了一个网页,它在http://localhost:8000/。我读过,但是,我不知道如何设置我的本地ip 当我在终端ifconfig中写入此代码时,它显示如下: eth0 Link encap:Ethernet HWaddr 18:a9:05:dd:32:fc UP BROADC
http://localhost:8000/
。我读过,但是,我不知道如何设置我的本地ip
当我在终端ifconfig
中写入此代码时,它显示如下:
eth0 Link encap:Ethernet HWaddr 18:a9:05:dd:32:fc
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth1 Link encap:Ethernet HWaddr 90:4c:e5:3b:fe:c3
inet addr:192.168.1.18 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::924c:e5ff:fe3b:fec3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9880 errors:0 dropped:0 overruns:0 frame:7882
TX packets:9386 errors:12 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9839915 (9.8 MB) TX bytes:1643176 (1.6 MB)
Interrupt:16 Base address:0xc000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:1535 errors:0 dropped:0 overruns:0 frame:0
TX packets:1535 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:222541 (222.5 KB) TX bytes:222541 (222.5 KB)
如何设置它以使用我的无线连接在其他计算机上查看我的本地网站
非常感谢你的帮助 只需将此添加到您的普通runserver命令中:
python manage.py runserver 0.0.0.0:8000
然后本地网络上的其他人可以通过以下方式访问:
http://192.168.1.18:8000
您可以将Django服务器绑定到计算机的IP地址,然后在同一LAN上的其他计算机上点击该地址:
$ python manage.py runserver 192.168.1.18:8000