环境是ubuntu18.04+python3.8.8
首先安装好anaconda环境,后面的包都用conda安装,能自动解决依赖问题。
- conda换清华源
- conda config --add channels conda-forge
- conda config --set channel_priority flexible
- conda update -n base conda
- conda update --all
- conda install -c conda-forge uwsgi
新建文件test.py
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return [b"Hello World"]
输入命令
uwsgi --http :8001 --wsgi-file test.py安装nginx
- sudo apt-get install nginx
改nginx.conf(改之前先备份)
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
server {
listen 8080;
server_name localhost;
charset utf-8;
location / {
root html;
index index.html inde.htm;
}
}
}
root账号运行命令
sudo su nginx配置nginx+uwsgi+django



