【问题标题】:Setting up local ip over wireless network to create a local server on Ubuntu通过无线网络设置本地 ip 以在 Ubuntu 上创建本地服务器
【发布时间】:2023-03-13 07:33:02
【问题描述】:

我正在使用 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 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)

如何设置它以使用我的无线连接在其他计算机上查看我的本地网站。

非常感谢您的帮助!

【问题讨论】:

    标签: django ubuntu localhost network-protocols wireless


    【解决方案1】:

    您可以将您的 Django 服务器绑定到您机器的 IP 地址,然后在同一 LAN 上的其他机器上点击该地址:

    $ python manage.py runserver 192.168.1.18:8000
    

    【讨论】:

      【解决方案2】:

      只需将其添加到您的正常运行服务器命令中:

      python manage.py runserver 0.0.0.0:8000
      

      然后您本地网络上的其他人可以通过以下方式访问它:

      http://192.168.1.18:8000
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-01-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多