服务器:腾讯云 s2 标准版
系统版本:ubuntu 16.04
django版本:1.10
项目的部署步骤:
一:安装uwsgi
1.安装uwsgi之前首先要配置c-python解释器:sudo apt-get install build-essential python-dev
2.安装uwsgi:sudo pip install uwsgi
3.测试是否安装成功uwsgi --http :8000 --wsgi-file test.py
可以看到安装成功,先把uwsgi结束
二:
1.在我的django项目根目录下创建jjmovie_uwsgi.ini配置文件 以及 uwsgi_params 文本文件
在配置文件中添加:
1 # wxmovie_uwsgi.ini file 2 [uwsgi] 3 4 # Django-related settings 5 6 socket = :8004 7 8 # the base directory (full path) 9 chdir = /home/ubuntu/jjmovie10 11 # Django s wsgi file12 module = jjmovie.wsgi13 14 # process-related settings15 # master16 master = true17 18 # maximum number of worker processes19 processes = 120 threads = 121 22 # ... with appropriate permissions - may be needed23 # chmod-socket = 66424 # clear environment on exit25 vacuum = true26 python-autoreload = 1
在文本文件中插入:
1 uwsgi_param QUERY_STRING $query_string; 2 uwsgi_param REQUEST_METHOD $request_method; 3 uwsgi_param CONTENT_TYPE $content_type; 4 uwsgi_param CONTENT_LENGTH $content_length; 5 6 uwsgi_param REQUEST_URI $request_uri; 7 uwsgi_param PATH_INFO $document_uri; 8 uwsgi_param DOCUMENT_ROOT $document_root; 9 uwsgi_param SERVER_PROTOCOL $server_protocol;10 uwsgi_param REQUEST_SCHEME $scheme;11 uwsgi_param HTTPS $https if_not_empty;12 13 uwsgi_param REMOTE_ADDR $remote_addr;14 uwsgi_param REMOTE_PORT $remote_port;15 uwsgi_param SERVER_PORT $server_port;16 uwsgi_param SERVER_NAME $server_name;