【发布时间】:2018-07-31 17:27:50
【问题描述】:
我正在尝试更改 django 项目 url,以便想要连接到局域网中网站的用户将看到 url 而不是 localhost:8000 或 127.0.0.1。我需要将 localhost:8000/users/board 更改为 http://example.eu。我试过python manage.py runserver http://example.eu然后考虑更改网址,但它不起作用。还尝试更改主机文件(Windows 操作系统),但据我了解,我需要真实的 IP 地址而不是 url。是否有可能做这件事以及如何做?
【问题讨论】:
-
您正在寻找的命令是我认为
python manage.py runserver 0.0.0.0:8000这将在您机器的 ip 而不是本地主机上运行服务器。如果你想在你的域上运行你的服务器,那么使用 nginx -
python manage.py runserver yourhost:port_number
标签: django