Deployment payroll system

 Django + uwsgi + nginx + virtualenv

uwsgi.ini arrangement

[uwsgi]
 # use Connect using nginx, Django server address where the program 
socket = 0.0.0.0: 10001 # directly do use the web server, Django server address where the program 
; HTTP = 0.0.0.0: 10001 # project directory 
chdir = / opt / payslip
 # project directory wsgi.py file, relative to the project directory 
WSGI-file = payslip / wsgi.py
 # number of processes 
processes = 2 # threads 
threads = 2 # role uwsgi server 
Master = True
 # storage process number of file 
= the PidFile uwsgi.pid
 # log file because uwsgi from the terminal can run in the background, invisible to the log. Our previous runserver is dependent on the terminal 
daemonize = uwsgi.log
 # specified dependency virtual environment




virtualenv=/home/shion/.virtualenvs/payslip

Nginx configuration:

 1 server {
 2     listen 10000;
 3     listen [::]:10000 default_server;
 4 
 5 
 6     root /var/www/html;
 7 
 8     # Add index.php to the list if you are using PHP
 9     index index.html index.htm index.nginx-debian.html;
10 
11     server_name localhost.com;
12 
13     location / {
14         # First attempt to serve request as file, then
15         # as directory, then fall back to displaying a 404.
16         include /etc/nginx/uwsgi_params;
17         uwsgi_pass 0.0.0.0:10001;
18         root html;
19         index index.html index.htm;
20     }
21     location /static {
22         alias /opt/payslip/static;
23         
24     }
Nginx.conf

Precautions

  1, the port number uwsgi inside nginx reverse proxy configurations and port could not have been, or will lead to uwsgi not start

  2, virtualenv environment should be python3 environment, did not pay attention for a long time before the investigation led to problems  

mkvirtualenv -p /usr/bin/python3.6 payslip

nginx related commands

nginx - S GR reload 
nginx - S STOP Stop nginx 
nginx start nginx

 

Guess you like

Origin www.cnblogs.com/echo2019/p/11867813.html