测试uwsgi出错,无法访问ip地址

在阿里云服务器上部署django项目,编写test.py测试uwsgi,无法访问ip地址
以下为终端信息



 Starting uWSGI 2.0.21 (64bit) on [Sat May  6 16:58:02 2023] ***
compiled with version: 11.3.0 on 06 May 2023 08:33:59
os: Linux-5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023
nodename: iZ0jlb6q9efs1ffysfq72rZ
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /root
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 6426
your memory page size is 4096 bytes
detected max file descriptor number: 65535
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on 0.0.0.0:8000 fd 4
spawned uWSGI http 1 (pid: 116213)
uwsgi socket 0 bound to TCP address 127.0.0.1:42219 (port auto-assigned) fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Python version: 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x5555667fc080
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72904 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x5555667fc080 pid: 116212 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 116212, cores: 1)

如果是阿里云,默认是不允许访问的,需要在settings.py配置文件中添加允许访问的IP地址。如允许所有IP访问你的方法是: ALLOWED_HOSTS = ["*"] ,之后输入:https://阿里云IP:8081 就可以访问部署的django项目。有些时候还是会出现问题,