wget https://bootstrap.pypa.io/ez_setup.py -O - | python安装setuptools
unzip setuptools-5.8.zip
cd setuptools-5.8
/usr/local/python-3.3/bin/python3.3 setup.py build
下载uwsgi
wget http://projects.unbit.it/downloads/uwsgi-latest.tar.gz
下载django
wget https://github.com/django/django/archive/master.zip
在网站路径里面新加个文件uwsgi.ini
[uwsgi] socket=0.0.0.0:9005 chdir=/app/dataservice/ pythonpath=/usr/local/python-3.3/bin/python3.3 master=1 processes=2 wsgi-file=/app/dataservice/dataService/wsgi.py buffer-size=100000
说明:http=0.0.0.0:9005 是指用http方式,这样,不通过Nginx等web服务器,也可以外部访问这个程序。如果是使用web服务器,必须使用socket方式.
关闭:
killall -9 uwsgi
启动:
前台启动:
uwsgi uwsgi.ini
后台启动:
uwsgi /app/dataservice/uwsgi.ini -d /app/dataservice/uwsgi.log
Nginx配置:
server { listen 8001; server_name 10.20.126.81; access_log logs/8001.log; large_client_header_buffers 4 16k; client_max_body_size 300m; client_body_buffer_size 128k; ssl_certificate ssl/app.data.crt; ssl_certificate_key ssl/app.data.key; error_log logs/mobile_error.log notice; location / { root /app/dataservice; uwsgi_pass 127.0.0.1:9005; include uwsgi_params; } location /static/ { root /app/dataservice; if (-f $request_filename) { rewrite ^/static/(.*)$ /static/$1 break; } } location ~ /\.ht { deny all; } }