UI基础 属性代理传值
Posted zhangqing979797
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UI基础 属性代理传值相关的知识,希望对你有一定的参考价值。
nginx,uwsgi
# 配置 /home/liuwei/mycode/py/FlaskDemo/uwsgi.ini [uwsgi] #application‘s base folder,配置为项目的根目录 base = /home/liuwei/mycode/py/FlaskDemo #python module to import # 这个app的值指的就是flask应用下的app.py app = app module = %(app) # 项目依赖的环境目录 home = /home/liuwei/mycode/py/envs/flaskdemoenv pythonpath = %(base) #socket file‘s location,生成nginx依赖的文件,其中%n表示当前文件的名字 socket = %(base)/%n.sock #permissions for the socket file chmod-socket = 666 #the variable that holds a flask application inside the module imported at line #6 callable = app #location of log files logto = /var/log/uwsgi/%n.log
# 创建上面配置logto的文件夹,以及降权限 sudo mkdir -p /var/log/uwsgi sudo chown -R liuwei:liuwei /var/log/uwsgi
# cd /home/liuwei/mycode/py/FlaskDemo uwsgi --ini uwsgi.ini # 当启动后,就会在项目目录下生成uwsgi.sock文件,这个文件被nginx依赖,所以你要先启动uwsgi #日志需要注意参数: # current working directory # detected binary path # uwsgi socket 0 bound to UNIX address # PythonHome、Python Version # 是否有报错信息 # 查看启动成功的日志: *** Starting uWSGI 2.0.18 (64bit) on [Tue Dec 10 17:12:46 2019] *** compiled with version: 7.4.0 on 07 December 2019 04:39:53 os: Linux-5.0.0-37-generic #40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019 nodename: liuwei-ThinkPad-E450 machine: x86_64 clock source: unix detected number of CPU cores: 4 current working directory: /home/liuwei/mycode/py/FlaskDemo detected binary path: /home/liuwei/mycode/py/envs/flaskdemoenv/bin/uwsgi !!! no internal routing support, rebuild with pcre support !!! *** WARNING: you are running uWSGI without its master process manager *** your processes number limit is 31398 your memory page size is 4096 bytes detected max file descriptor number: 1048576 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uwsgi socket 0 bound to UNIX address /home/liuwei/mycode/py/FlaskDemo/uwsgi.sock fd 3 Python version: 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0] Set PythonHome to /home/liuwei/mycode/py/envs/flaskdemoenv *** Python threads support is disabled. You can enable it with --enable-threads *** Python main interpreter initialized at 0x565080299420 your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 72904 bytes (71 KB) for 1 cores *** Operational MODE: single process *** added /home/liuwei/mycode/py/FlaskDemo/ to pythonpath. WSGI app 0 (mountpoint=‘‘) ready in 0 seconds on interpreter 0x565080299420 pid: 31106 (default app) *** uWSGI is running in multiple interpreter mode *** spawned uWSGI worker 1 (and the only) (pid: 31106, cores: 1)
user root; worker_processes auto; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; # /×××/ngin -c /×××/nginx.conf -s stop pid /usr/local/nginx/nginx.pid; events { worker_connections 1024; } http { include /usr/local/nginx/mime.types; default_type application/octet-stream; #log_format main ‘$remote_addr - $remote_user [$time_local] "$request" ‘ # ‘$status $body_bytes_sent "$http_referer" ‘ # ‘"$http_user_agent" "$http_x_forwarded_for"‘; #access_log logs/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; gzip on; gzip_disable "msie6"; server { listen 80 default_server; #listen [::]:80 default_server; #charset koi8-r; #access_log logs/host.access.log main; root /home/liuwei/mycode/py/FlaskDemo; server_name _; location /static { alias /home/liuwei/mycode/py/FlaskDemo/static; } location / { try_files $uri @yourapplication; } location @yourapplication { include /usr/local/nginx/uwsgi_params; # 这是和django有差别的地方 uwsgi_pass unix:/home/liuwei/mycode/py/FlaskDemo/uwsgi.sock; } } }
# 创建上面配置logto的文件夹,以及降权限 sudo mkdir -p /var/log/nginx sudo chown -R liuwei:liuwei /var/log/nginx
# 启动 /***/nginx -t -c /***/nginx.conf /***/nginx -c /***/nginx.conf /***/nginx -c /***/nginx.conf -s stop
以上是关于UI基础 属性代理传值的主要内容,如果未能解决你的问题,请参考以下文章