Changing the port
By default, the runserver command starts the development server on the internal IP at port 8000.
If you want to change the server's port, pass it as a command-line argument. For instance, this command starts the server on port 8080:
python manage.py runserver 8080
If you want to change the server's IP, pass it along with the port. So to listen on all public IPs (useful if you want to show off your work on other computers), use:
python manage.py runserver 0.0.0.0:8000
Full docs for the development server can be found in the runserver reference.
本文介绍如何通过命令行参数来更改Django项目的开发服务器默认监听的端口及IP地址,使服务器能在指定端口运行或监听所有公共IP。
1187

被折叠的 条评论
为什么被折叠?



