gpt4 book ai didi

python-3.x - uWSGI +nginx 设置 - Dash (Plotly) 部署

转载 作者:行者123 更新时间:2023-12-03 15:54:57 24 4
gpt4 key购买 nike

我是 flask 和部署过程的新手
我有我的 dash.py 设置

server = flask.Flask(__name__)
app = dash.Dash(__name__, server=server)

和我的 nginx 文件一样
server {
listen 80;
server_name localhost;
charset utf-8;
client_max_body_size 75M;

location / {try_files $uri @yourapplication; }
location @yourapplication {
include uwsgi_params;
uwsgi_pass unix:/var/www/School-Dashboard/dash_clean.sock;
}
}

…但我不确定我必须在我的 wsgi ini 文件中将模块参数设置为什么。
[uwsgi]
#application's base folder
base = /var/www/School-Dahboard

#python module to import
module = dash_clean:app #?????? WHAT DO I DO HERE

#home = %(base)/venv
pythonpath = %(base)

#socket file's location
socket = /var/www/School-Dashboard/dash_clean.sock

#permissions for the socket file
chmod-socket = 660


#location of log files
logto = /var/log/uwsgi/%n.log

由于我的 uwsgi 文件,我不断收到错误的网关错误。

这是来自 uwsgi 的日志。
Starting uWSGI 2.0.17.1 (64bit) on [Mon Nov  5 12:47:42 2018] ***
compiled with version: 5.4.0 20160609 on 03 November 2018 06:53:29
os: Linux-4.15.0-36-generic #39~16.04.1-Ubuntu SMP Tue Sep 25 08:59:23 UTC 2018
nodename: xxxxxxxx
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /var/www/School-Dashboard
detected binary path: /home/concent/.local/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 31145
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /var/www/School-Dashboard/dash_clean.sock fd 3
Python version: 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x22b9330
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72920 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
added /var/www/School-Dahboard to pythonpath.
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x22b9330 pid: 20070 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 20070, cores: 1)

最佳答案

所以我已经设置了nginx...

server {
server_name 0.0.0.0;
listen 80;
root /home/ubuntu/school_dashboard;
client_max_body_size 200M;
include /etc/nginx/default.d/*.conf;

location /dependencies {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_pass http://0.0.0.0:5005;
#index wsgi.py
include uwsgi_params;
uwsgi_pass unix:/home/ubuntu/school_dashboard/dependencies/urlgen.sock;
}
}

和我的 uwsgi 文件为....
[uwsgi]
module = dash_clean:server

master = true
processes = 5

socket = dashboard.sock
chmod-socket = 660
vacuum = true

die-on-term = true

我只需要更改模块参数

关于python-3.x - uWSGI +nginx 设置 - Dash (Plotly) 部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53151591/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com