测试环境:linux centos7下

1、安装uwsgi

python3下安装:

pip3 install uwsgi

python2下安装:

pip install uwsgi

如果是系统自带的python2.7环境下安装的话,有可能会出错:

Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-
jjOBXy/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-3cX7u0-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-jjOBXy/uwsgi/

这时候需要我们先安装一个python开发包:

yum install -y python-devel

然后就可以安装了

2、测试 uwsgi

django生产环境部署
#python 3.x
def application(env, start_response):
    start_response('200 OK', [('Content-Type','text/html')])
    return [b"Hello World"]   #Python 3.x 需要 返回字节字符串

#python 2.x
#def application(env, start_response):
#    start_response('200 OK', [('Content-Type','text/html')])
#    return ["Hello World"]
test.py

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2018-07-24
  • 2022-01-25
  • 2021-08-16
猜你喜欢
  • 2022-12-23
  • 2021-07-29
  • 2022-12-23
  • 2022-12-23
  • 2021-07-10
  • 2021-09-02
  • 2022-01-20
相关资源
相似解决方案