您好,我是debian13系统,使用的Python环境是
- /www/server/pyporject_evn/versions/3.14.3/bin/uwsgi
复制代码
测试跑 uwsgi运行测试案例,正常运行。(可能我用的系统是刚安装过的),您尝试更新下系统试试
- apt update -y && apt upgrade -y
复制代码
测试代码:
myapp.py
- def application(environ, start_response):
- # 设置响应头
- status = '200 OK'
- headers = [('Content-Type', 'text/html; charset=utf-8')]
- start_response(status, headers)
- # 页面内容
- content = """
- <html>
- <head><title>uWSGI Powered</title></head>
- <body>
- <h1 style="color: #2c3e50;">Hello from uWSGI!</h1>
- <p>这是一个由 Debian13 + uWSGI 驱动的简单页面。</p>
- <hr>
- <small>Server Time: 2026-03-04</small>
- </body>
- </html>
- """
- return [content.encode('utf-8')]
复制代码
uwsgi.ini 注意要放行8089端口
- [uwsgi]
- # 监听端口
- http = :8089
- # 项目目录和脚本
- chdir = .
- wsgi-file = myapp.py
- # 进程管理
- master = true
- processes = 4
- threads = 2
- # 这里的 application 是 myapp.py 里的函数名
- callable = application
- # 退出时自动清理环境
- vacuum = true
复制代码 |