Python Django在运行服务器时指定默认地址和默认端口
有没有办法在DJANGO\u SETTINGS\u模块(setting.py)中指定IP:Port,而不是使用Python Django在运行服务器时指定默认地址和默认端口,python,django,Python,Django,有没有办法在DJANGO\u SETTINGS\u模块(setting.py)中指定IP:Port,而不是使用 python manage.py runserver <ip>:<port>? python manage.py运行服务器:? 与我们指定允许的\u主机、内部\u IP等类似,您可以在设置中添加默认地址和默认端口。py: from django.core.management.commands.runserver import Command as runs
python manage.py runserver <ip>:<port>?
python manage.py运行服务器:?
与我们指定允许的\u主机、内部\u IP等类似,您可以在
设置中添加默认地址
和默认端口
。py
:
from django.core.management.commands.runserver import Command as runserver
ALLOWED_HOSTS = ['*']
runserver.default_port = '8000' # <-- Your port
runserver.default_addr = '127.0.0.1' # <-- Your address
从django.core.management.commands.runserver导入命令作为runserver
允许的_主机=['*']
runserver.default_port='8000'#工作起来很有魅力。非常感谢。