我在Windows 10上。我正在运行django服务器,其中显示以下内容:
python manage.py runserver
Watching for file changes with StatReloader
This is the DRF tutorial. When I go to http://127.0.0.1:8000/users/, I get the screen you get when your internet is down:
This site can’t be reached 127.0.0.1 refused to connect.
每次我访问URL时,服务器都不会注册任何东西。通常,将打印新行以显示请求,并显示200或错误。 运行django服务器后,我从未见过这种情况。我通常也不会在我更喜欢linux的Windows上使用python。我假设这是Windows问题。任何帮助表示赞赏
You can't use
python manage.py runserver
without specifying the port. the only thing you have to do is just add port next to your command:使用以下命令,您的Django项目将在端口8000上的本地服务器上运行,您可以使用以下URL访问它:
localhost:8000 or 127.0.0.1:8000