机器TestPC-A中的Django服务器,地址为192.25.56.120
我希望从同一网络192.25.56.xxx中的计算机访问它.
我已配置的内容
1. settings.py个
ALLOWED_HOSTS = ["127.0.0.1", "localhost", "TestPC-A" , "0.0.0.0", "192.25.56.120"]
#and this which I am not sure if this is necessary:
CSRF_TRUSTED_ORIGINS = [
"http://127.0.0.1",
"https://127.0.0.1",
"http://localhost",
"https://localhost",
"https://TestPC-A",
"http://TestPC-A",
]
2. runserver.bat个
@echo off
REM Activate virtual environment in the current terminal session and run server
cmd /k ".venv\Scripts\activate && python manage.py runserver_plus --cert-file cert.pem --key-file key.pem 0.0.0.0:8000"
我try 在Windows主机文件C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS中添加以下内容
192.25.56.120 TestPC-A
我重新启动服务器,并且网页没有在另一台计算机的网络浏览器https://TestPC-A:8000/
处加载
我还需要设置什么?